comp.lang.ada
 help / color / mirror / Atom feed
From: Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject: Re: CONSTRAINT_ERROR - why?
Date: Sat, 14 Dec 2002 12:58:13 -0800
Date: 2002-12-14T22:03:02+00:00	[thread overview]
Message-ID: <616gta.hk3.ln@beastie.ix.netcom.com> (raw)
In-Reply-To: 3DFB8495.A655C512@t-online.de

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/             <




  reply	other threads:[~2002-12-14 20:58 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-14 18:28 CONSTRAINT_ERROR - why? Alfred Hilscher
2002-12-14 18:45 ` James S. Rogers
2002-12-14 19:15   ` Robert A Duff
2002-12-14 19:20     ` James S. Rogers
2002-12-14 19:42     ` Alfred Hilscher
2002-12-16  2:39       ` AG
2002-12-14 19:20   ` Alfred Hilscher
2002-12-14 20:58     ` Dennis Lee Bieber [this message]
2002-12-15 13:45       ` Alfred Hilscher
2002-12-15 19:04         ` Robert A Duff
2002-12-16  1:12         ` Dennis Lee Bieber
2002-12-16  2:20           ` Jeffrey Carter
2002-12-16 18:48             ` Alfred Hilscher
2002-12-16 19:53               ` James S. Rogers
2002-12-17 18:20                 ` Alfred Hilscher
2002-12-17 19:29                   ` Robert A Duff
2002-12-17 21:05                     ` Dennis Lee Bieber
2002-12-18 18:36                     ` Alfred Hilscher
2002-12-18 18:51                       ` Robert A Duff
2002-12-18 21:45                         ` Randy Brukardt
2002-12-19 16:49                           ` Robert Spooner
2002-12-19 20:57                             ` Randy Brukardt
2002-12-14 20:19 ` Jeffrey Carter
2002-12-14 22:26   ` Alfred Hilscher
2002-12-15  0:49     ` Dennis Lee Bieber
2002-12-15  2:18     ` Jeffrey Carter
2002-12-15 18:23       ` Jeffrey Carter
2002-12-15 14:01   ` Alfred Hilscher
2002-12-15 18:20     ` Jeffrey Carter
2002-12-15 19:00       ` Alfred Hilscher
2002-12-16  1:16         ` Dennis Lee Bieber
2002-12-16 18:50           ` Alfred Hilscher
2002-12-17  2:17             ` Dennis Lee Bieber
2002-12-17 18:21               ` Alfred Hilscher
     [not found]                 ` <26tuvu4ekeigls0bnd2okavrdhfu0tir4a@4ax.com>
2002-12-18 18:47                   ` Alfred Hilscher
replies disabled

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