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-Thread: 103376,4eca860272d4832b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!newsfeed.gamma.ru!Gamma.RU!news.germany.com!news.belwue.de!th!lucks From: Stefan Lucks Newsgroups: comp.lang.ada Subject: Re: Static vs dynamic evaluation anomaly? Date: Fri, 9 Feb 2007 22:12:28 +0100 Organization: InterNetNews at News.BelWue.DE (Stuttgart, Germany) Message-ID: References: <12shen4qjhv41a7@corp.supernews.com> <1170792077.235994.10900@q2g2000cwa.googlegroups.com> <87d54mguco.fsf@ludovic-brenta.org> <1170843700.7656.47.camel@localhost.localdomain> <1170866664.465875.309930@v45g2000cwv.googlegroups.com> <1170874545.463017.180430@j27g2000cwj.googlegroups.com> <1170897971.419567.78410@a34g2000cwb.googlegroups.com> <2cKyh.337215$FQ1.333812@attbi_s71> NNTP-Posting-Host: th.informatik.uni-mannheim.de Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: news.BelWue.DE 1171055550 3221 134.155.91.85 (9 Feb 2007 21:12:30 GMT) X-Complaints-To: news@news.belwue.de NNTP-Posting-Date: Fri, 9 Feb 2007 21:12:30 +0000 (UTC) In-Reply-To: Xref: g2news2.google.com comp.lang.ada:9215 Date: 2007-02-09T22:12:28+01:00 List-Id: On Fri, 9 Feb 2007, Jeffrey R. Carter wrote: > OK. I would say that this is a compiler error. But I can still see how > the compiler writer could argue that it is not. OK, does the following test case convince you, that the compiler writer cannot reasonably deny that the compiler is false (if -gnatp or no compiler options are chosen)? The only kind of defense on the side of the compiler writer I can still imagine is that gnat without the -gnato option isn't an Ada compiler, but rather a compiler for a language with an Ada syntax but a non-Ada semantic. --- with Ada.Text_IO; use Ada.Text_IO; procedure test273 is type Six_Bits is mod 2**6; X: constant Six_Bits := 31; Z: constant Integer := 31; Outside : Boolean; begin for J in 0..9 loop Outside := True; Put (Integer 'Image (J) & Six_Bits'Image (X * 2**J) ); for I in Six_Bits loop if (X * 2**J) = I then Put(" equal to" & Six_Bits'Image(I)); Outside := False; end if; end loop; if Outside then Put(" (value NOT IN"); else Put(" (value in"); end if; Put_Line(Six_Bits'Image(Six_Bits'First) & " .." & Six_Bits'Image(Six_Bits'Last) & ")!" ); end loop; end test273; --- gnatmake test273 --- ./test273 0 31 equal to 31 (value in 0 .. 63)! 1 62 equal to 62 (value in 0 .. 63)! 2 124 (value NOT IN 0 .. 63)! 3 248 (value NOT IN 0 .. 63)! 4 240 (value NOT IN 0 .. 63)! 5 224 (value NOT IN 0 .. 63)! 6 192 (value NOT IN 0 .. 63)! 7 128 (value NOT IN 0 .. 63)! 8 0 equal to 0 (value in 0 .. 63)! 9 0 equal to 0 (value in 0 .. 63)! -- Stefan Lucks Th. Informatik, Univ. Mannheim, 68131 Mannheim, Germany e-mail: lucks@th.informatik.uni-mannheim.de home: http://th.informatik.uni-mannheim.de/people/lucks/ ------ I love the taste of Cryptanalysis in the morning! ------