comp.lang.ada
 help / color / mirror / Atom feed
From: "Steve" <nospam_steved94@comcast.net>
Subject: Re: Static vs dynamic evaluation anomaly?
Date: Tue, 6 Feb 2007 19:32:57 -0800
Date: 2007-02-06T19:32:57-08:00	[thread overview]
Message-ID: <HI6dnX9pKMXb1VTYnZ2dnUVZ_vupnZ2d@comcast.com> (raw)
In-Reply-To: 1170792077.235994.10900@q2g2000cwa.googlegroups.com

"Adam Beneschan" <adam@irvine.com> wrote in message 
news:1170792077.235994.10900@q2g2000cwa.googlegroups.com...
> On Feb 6, 9:29 am, Matt Jaffe <jaf...@cableone.net> 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,

Steve
(The Duck)

>                      -- Adam
> 





  parent reply	other threads:[~2007-02-07  3:32 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <12shen4qjhv41a7@corp.supernews.com>
2007-02-06 19:17 ` Static vs dynamic evaluation anomaly? Jeffrey R. Carter
2007-02-06 20:01 ` Adam Beneschan
2007-02-06 20:15   ` Ludovic Brenta
2007-02-06 23:38     ` Matt.Jaffe
     [not found]     ` <12sipb529oilnab@corp.supernews.com>
2007-02-07 10:05       ` Ludovic Brenta
2007-02-07 21:54       ` Simon Wright
2007-02-09 12:39         ` GNAT's version Peter Hermann
2007-02-07  3:32   ` Steve [this message]
2007-02-07 10:00     ` Static vs dynamic evaluation anomaly? Ludovic Brenta
2007-02-07 10:21       ` Georg Bauhaus
2007-02-07 16:44         ` Adam Beneschan
2007-02-07 18:27           ` Jeffrey R. Carter
2007-02-07 18:55             ` Adam Beneschan
2007-02-07 21:52               ` Simon Wright
2007-02-08  0:48               ` Jeffrey R. Carter
2007-02-08  1:26                 ` Adam Beneschan
2007-02-08 18:44                   ` Jeffrey R. Carter
2007-02-09  7:57                     ` Stefan Lucks
2007-02-09 18:50                       ` Jeffrey R. Carter
2007-02-09 21:12                         ` Stefan Lucks
2007-02-10  5:22                           ` Jeffrey R. Carter
2007-02-10 12:29                             ` Ludovic Brenta
2007-02-08  6:57             ` Matt Jaffe
2007-02-08  9:01               ` Ludovic Brenta
2007-02-08 10:32                 ` Georg Bauhaus
2007-02-08 11:13                 ` Jean-Pierre Rosen
2007-02-08 13:02                   ` Ludovic Brenta
2007-02-07 21:46         ` Matt.Jaffe
2007-02-07  6:24   ` AW: " Grein, Christoph (Fa. ESG)
2007-02-07  6:59     ` Stefan Lucks
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox