From: Ludovic Brenta <ludovic.brenta@insalien.org>
Subject: Re: Is this a gnat bug?
Date: 21 Sep 2003 01:09:54 +0200
Date: 2003-09-21T01:09:54+02:00 [thread overview]
Message-ID: <m3he379hvh.fsf@insalien.org> (raw)
In-Reply-To: bkilj3$kl5$1@panorama.wcss.wroc.pl
hebisch@math.uni.wroc.pl (Waldek Hebisch) writes:
> I am trying to convert a sequence of eight bytes to a fixed point
> number. For testing I put bytes in an array. I first collect bytes
> in a modular type and then assign the result to an integer (I have
> eight bytes in big endian order, but the actual number should be
> small). When number formed from 4 lower order bytes is out of
> range I get CONSTRAINT_ERROR but if only higher order bytes are
> non-zero I get just zero result. I would expect CONSTRAINT_ERROR
> always when any of higher order bytes is non-zero. With both
> gnat-3.14p and gnat from gcc-3.3 the program below prints huge
> number for 'pp' and 0.0 for 'price'.
Compile with -gnato. With GNAT, range checks are disabled by default
for performance. Here is what I get with 3.15p:
$ gnatmake -O3 tstnum
gnatgcc -c -O3 tstnum.adb
gnatbind -x tstnum.ali
gnatlink tstnum.ali
$ ./tstnum
pp = 17868022686844715008
price = 0.00
$ gnatmake -s -gnato -O3 tstnum
gnatgcc -c -gnato -O3 tstnum.adb
gnatbind -x tstnum.ali
gnatlink tstnum.ali
$ ./tstnum
pp = 17868022686844715008
raised CONSTRAINT_ERROR : tstnum.adb:20 overflow check failed
HTH
--
Ludovic Brenta.
next prev parent reply other threads:[~2003-09-20 23:09 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-20 22:50 Is this a gnat bug? Waldek Hebisch
2003-09-20 23:09 ` Ludovic Brenta [this message]
2003-09-21 2:37 ` Waldek Hebisch
-- strict thread matches above, loose matches on Subject: below --
2002-04-26 16:36 Is this a GNAT bug??? Robert Quinn
2002-04-26 17:48 ` Mark Johnson
2002-04-26 22:20 ` Robert Dewar
2002-04-29 15:45 ` Robert Quinn
2002-04-30 2:44 ` Robert Dewar
2002-04-30 14:15 ` Larry Kilgallen
2002-04-30 16:41 ` Robert Quinn
2002-04-30 18:20 ` tmoran
2002-05-01 1:31 ` Robert Quinn
2002-05-01 17:08 ` Ted Dennison
2002-05-02 1:55 ` Larry Kilgallen
2002-05-02 14:04 ` Mark Johnson
2002-05-02 15:25 ` Larry Kilgallen
2002-04-30 21:55 ` Mark Johnson
2002-05-01 22:59 ` Nick Roberts
2002-05-02 13:56 ` Mark Johnson
2002-05-02 20:19 ` Nick Roberts
2002-05-02 21:55 ` Mark Johnson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox