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

* Re: compiler error in GNAT 3.14a1
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Preben Randhol @ 2004-02-12 12:10 UTC (permalink / raw)


On 2004-02-12, Vincent Smeets <Nobody@No.SPAM.org> wrote:
> 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$
>
>

Using Gnat 3.15p I get:


% gnatmake -c -gnatR2 -gnatv -gnatwa a.ads
gnatgcc -c -gnatR2 -gnatv -gnatwa a.ads

GNAT 3.15p  (20020523) Copyright 1992-2002 Free Software Foundation, Inc.

Compiling: a.ads (source file time stamp: 2004-02-12 12:09:21)

    27.          E at 0 range 0 .. 0 * 8 - 1;
                                         |
        >>> size for "E" too small, minimum allowed is 32

 32 lines: 1 error

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;
gnatmake: "a.ads" compilation error


-- 
"Saving keystrokes is the job of the text editor, not the programming
 language."



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

* Re: compiler error in GNAT 3.14a1
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Leake @ 2004-02-13  1:17 UTC (permalink / raw)
  To: comp.lang.ada

"Vincent Smeets" <Nobody@No.SPAM.org> writes:

> Hallo,
> 
> I have found a compiler error in GNAT 3.14a1.

3.14a1 was only available to supported customers of ACT; you should
report the bug to them. If you are no longer supported, you should be
using the current public version 3.15p.

If you can't, for some reason, use 3.15p, it's best to say so when you
ask for help. Otherwise several people will simply tell you "get the
latest version".


-- 
-- Stephe




^ 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