comp.lang.ada
 help / color / mirror / Atom feed
* compiler error in GNAT 3.14a1
@ 2004-02-12  9:16 Vincent Smeets
  2004-02-12 12:10 ` Preben Randhol
  2004-02-13  1:17 ` Stephen Leake
  0 siblings, 2 replies; 3+ messages in thread
From: Vincent Smeets @ 2004-02-12  9:16 UTC (permalink / raw)


Hallo,

I have found a compiler error in GNAT 3.14a1.

I have a record D with two components E and F. The layout of the record is
defined by a representation clause. By a typing error, I defined the
bit-range to be zero (0 .. 0). See record D2. The compiler compiles the file
without an error or warning and changes the layout of the record.

I would at least acpect a warning from the compiler.



azha:592$ cat a.ads
package A is

   type B is range 0 .. 255;
   for B'Size use 8;

   type C is array (Integer range 1 .. 4) of B;
   for C'Component_Size use 8;

   type D is
      record
         E : C;
         F : B;
      end record;
   for D use
      record
         E at 0 range 0 .. 4 * 8 - 1;
         F at 4 range 0 ..     8 - 1;
      end record;

   type D2 is
      record
         E : C;
         F : B;
      end record;
   for D2 use
      record
         E at 0 range 0 .. 0 * 8 - 1;
         F at 4 range 0 ..     8 - 1;
      end record;

end A;
azha:593$ gcc -c -gnatR2 -gnatv -gnatwa a.ads

GNAT 3.14a1 (20010503) Copyright 1992-2001 Free Software Foundation, Inc.

Compiling: a.ads (source file time stamp: 2004-02-12 08:59:47)
 31 lines: No errors

Representation information for unit A (spec)
--------------------------------------------

for B'Size use 8;
for B'Alignment use 1;

for C'Size use 32;
for C'Alignment use 1;
for C'Component_Size use 8;

for D'Size use 40;
for D'Alignment use 1;
for D use record
   E at 0 range  0 .. 31;
   F at 4 range  0 ..  7;
end record;

for D2'Size use 72;
for D2'Alignment use 1;
for D2 use record
   E at 5 range  0 .. 31;
   F at 4 range  0 ..  7;
end record;
azha:594$





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-02-13  1:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-12  9:16 compiler error in GNAT 3.14a1 Vincent Smeets
2004-02-12 12:10 ` Preben Randhol
2004-02-13  1:17 ` Stephen Leake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox