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=-0.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FREEMAIL_REPLY autolearn=no 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 11:46:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.vmunix.org!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail From: Alfred Hilscher Newsgroups: comp.lang.ada Subject: Re: CONSTRAINT_ERROR - why? Date: Sat, 14 Dec 2002 20:42:55 +0100 Organization: T-Online Message-ID: <3DFB89BF.323CB3E3@t-online.de> References: <3DFB7841.F898C02@t-online.de> <3%KK9.53003$vM1.4249406@bgtnsc04-news.ops.worldnet.att.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.t-online.com 1039895064 07 5602 64j6EiHSSUAMsg 021214 19:44:24 X-Complaints-To: abuse@t-online.com X-Sender: 320001779794-0001@t-dialin.net X-Mailer: Mozilla 4.75 [de] (WinNT; U) X-Accept-Language: de Xref: archiver1.google.com comp.lang.ada:31825 Date: 2002-12-14T20:42:55+01:00 List-Id: Robert A Duff schrieb: > > "James S. Rogers" writes: > > > "Alfred Hilscher" wrote in message > > news:3DFB7841.F898C02@t-online.de... > > > This program raises exception CONSTRAINT_ERROR for the second > > > assignment. It happens with GNAT 3.13p and 3.14p (on windows). > > > > > > Can someone explain why? Is this a compiler error or do I misunderstand > > > something? > > > > > > I would expect that the computation is done first and then the result > > > (33 which is successfully assigned the statement before) is assigned. > > > But it seems that the size (=264) is assigned before the division is > > > executed. > > The 'Size is implicitly converted to BYTE, and then the "/" operator of > type BYTE is used. You want to do the division in, say, Integer, > and then explicitly convert to BYTE, like: > > ... := BYTE(Integer'(Fac_Conf_Struct'Size / 8)); Shouldn`t the conversion take place _after_ the computation? First compute ('size /8) as universal_integer and then adopt (for the assignment only) to the type of the right side?