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,7be3870dd9c9518f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-14 17:43:07 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn14feed!wn12feed!wn11feed!worldnet.att.net!207.217.77.102!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!harp.news.atl.earthlink.net!beastie.ix.netcom.com!nobody From: Dennis Lee Bieber Newsgroups: comp.lang.ada Subject: Re: CONSTRAINT_ERROR - why? Date: Sat, 14 Dec 2002 12:58:13 -0800 Organization: >> Leaf-Eating Penguins? << Message-ID: <616gta.hk3.ln@beastie.ix.netcom.com> References: <3DFB7841.F898C02@t-online.de> <3%KK9.53003$vM1.4249406@bgtnsc04-news.ops.worldnet.att.net> <3DFB8495.A655C512@t-online.de> NNTP-Posting-Host: a5.f7.cf.d1 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Server-Date: 14 Dec 2002 22:03:02 GMT User-Agent: KNode/0.6.1 X-noarchive: yes Xref: archiver1.google.com comp.lang.ada:31834 Date: 2002-12-14T22:03:02+00:00 List-Id: Alfred Hilscher fed this fish to the penguins on Saturday 14 December 2002 11:20 am: > > > Sorry. I've downloaded and installed GNAT 3.15p, and the exception > still comes. I've compiled with AdaGide, with "integer overflow check" > enabled. Turn the check off. I'd expect the return of 'size to be type larger than a byte (more likely full integer) and the compiler may be assuming that assignment of an integer (regardless of current value) to a BYTE is invalid. [wulfraed@beastie ada]$ gnatmake -v GNATMAKE 3.15p (20020523) Copyright 1995-2002 Free Software Foundation, Inc. Usage: gnatmake opts name {[-cargs opts] [-bargs opts] [-largs opts]} [wulfraed@beastie ada]$ gnatmake -gnato test gcc -c -gnato test.adb gnatbind -x test.ali gnatlink test.ali gnatlink: warning: executable name "test" may conflict with shell command [wulfraed@beastie ada]$ ./test Struct_Length= 33 raised CONSTRAINT_ERROR : test.adb:19 overflow check failed >From the user guide: -gnato Enables overflow checking for integer operations. This causes GNAT to generate slower and larger executable programs by adding code to check for overflow (resulting in raising Constraint_Error as required by standard Ada semantics). These overflow checks correspond to situations in which the true value of the result of an operation may be outside the base range of the result type. The following example shows the distinction: Without the check: [wulfraed@beastie ada]$ touch test.adb [wulfraed@beastie ada]$ gnatmake test gcc -c test.adb gnatbind -x test.ali gnatlink test.ali gnatlink: warning: executable name "test" may conflict with shell command [wulfraed@beastie ada]$ ./test Struct_Length= 33 [wulfraed@beastie ada]$ -- > ============================================================== < > wlfraed@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG < > wulfraed@dm.net | Bestiaria Support Staff < > ============================================================== < > Bestiaria Home Page: http://www.beastie.dm.net/ < > Home Page: http://www.dm.net/~wulfraed/ <