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,1d8973f9fd947fbd X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-09-20 16:11:01 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news2.telebyte.nl!newshub1.home.nl!home.nl!skynet.be!skynet.be!louie!tlk!not-for-mail Sender: lbrenta@lbrenta Newsgroups: comp.lang.ada Subject: Re: Is this a gnat bug? References: From: Ludovic Brenta User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Date: 21 Sep 2003 01:09:54 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: -= Belgacom Usenet Service =- NNTP-Posting-Host: 217.136.3.151 X-Trace: 1064099459 reader2.news.skynet.be 2972 217.136.3.151:36646 X-Complaints-To: usenet-abuse@skynet.be Xref: archiver1.google.com comp.lang.ada:42722 Date: 2003-09-21T01:09:54+02:00 List-Id: 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.