From: Preben Randhol <randhol+valid_for_reply_from_news@pvv.org>
Subject: Re: compiler error in GNAT 3.14a1
Date: Thu, 12 Feb 2004 12:10:48 +0000 (UTC)
Date: 2004-02-12T12:10:48+00:00 [thread overview]
Message-ID: <slrnc2mra6.pf.randhol+valid_for_reply_from_news@k-083152.nt.ntnu.no> (raw)
In-Reply-To: 402b4488$0$280$4d4ebb8e@read.news.de.uu.net
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."
next prev parent reply other threads:[~2004-02-12 12:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-12 9:16 compiler error in GNAT 3.14a1 Vincent Smeets
2004-02-12 12:10 ` Preben Randhol [this message]
2004-02-13 1:17 ` Stephen Leake
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox