From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1963c56ce0046a64 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-02-12 04:10:48 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!uio.no!ntnu.no!not-for-mail From: Preben Randhol Newsgroups: comp.lang.ada Subject: Re: compiler error in GNAT 3.14a1 Date: Thu, 12 Feb 2004 12:10:48 +0000 (UTC) Organization: PVV Message-ID: References: <402b4488$0$280$4d4ebb8e@read.news.de.uu.net> NNTP-Posting-Host: k-083152.nt.ntnu.no X-Trace: tyfon.itea.ntnu.no 1076587848 24712 129.241.83.152 (12 Feb 2004 12:10:48 GMT) X-Complaints-To: usenet@itea.ntnu.no NNTP-Posting-Date: Thu, 12 Feb 2004 12:10:48 +0000 (UTC) User-Agent: slrn/0.9.8.0 (Linux) Xref: archiver1.google.com comp.lang.ada:5480 Date: 2004-02-12T12:10:48+00:00 List-Id: On 2004-02-12, Vincent Smeets 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."