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!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.scarlet.biz!news.scarlet.biz.POSTED!not-for-mail NNTP-Posting-Date: Wed, 07 Feb 2007 04:01:07 -0600 From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: Static vs dynamic evaluation anomaly? References: <12shen4qjhv41a7@corp.supernews.com> <1170792077.235994.10900@q2g2000cwa.googlegroups.com> Date: Wed, 07 Feb 2007 11:00:55 +0100 Message-ID: <87d54mguco.fsf@ludovic-brenta.org> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) Cancel-Lock: sha1:usCIJI4uofE1h3hYrw6F3u+HHJQ= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: 62.235.220.88 X-Trace: sv3-fckOQpUZMsk9sjtwOMMEqdJcdBZgou2gD0YWQgl1Gjd5JJHXa1wejKgVtZzROa2EAj8Wjrvji7TP6O+!Wo8KtAeQdiggAp+Zg5Z/LqeazagMi/la4mfxI87JlrKazYu4efiPDCI6o6kZKl78F8XdeqCwEg== X-Complaints-To: abuse@scarlet.be X-DMCA-Complaints-To: abuse@scarlet.biz X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news2.google.com comp.lang.ada:9062 Date: 2007-02-07T11:00:55+01:00 List-Id: Steve writes: > Adam Beneschanwrote >> On Feb 6, 9:29 am, Matt Jaffe wrote: >> >>> Any further help in explaining these anomalies would be much appreciated. >>> (It's always possible we've stumbled across a compiler bug; but I am >>> reluctant to come to that conclusion prematurely.) >> >> I'm not so reluctant. It's a compiler bug. >> >> The following program produces incorrect results on GNAT, or at least >> on the version I'm using: >> >> with Ada.Text_IO; >> procedure test271 is >> type Six_Bits is mod 2**6; >> package Six_Bit_IO is new Ada.Text_IO.Modular_IO(Six_Bits); >> X : Six_Bits := 31; >> begin >> for J in 0..5 loop >> Ada.Text_IO.Put ("When J=" & Integer'image(J)); >> Ada.Text_IO.Put (", X*2**J ="); >> Six_Bit_IO.Put(X*2**J); >> Ada.Text_IO.New_Line; >> end loop; >> end test271; >> > > One more data point... ObjectAda 7.2.2 gives the result: > > When J= 0, X*2**J = 31 > When J= 1, X*2**J = 62 > When J= 2, X*2**J = 60 > When J= 3, X*2**J = 56 > When J= 4, X*2**J = 48 > When J= 5, X*2**J = 32 > > Which I believe is correct, > Regards, Actually I'll take back what I said earlier. With Debian gnat 4.1.1-22 I also get these seemingly correct results. -- Ludovic Brenta.