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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7be3870dd9c9518f,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-14 10:31:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.stueberl.de!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: CONSTRAINT_ERROR - why? Date: Sat, 14 Dec 2002 19:28:17 +0100 Organization: T-Online Message-ID: <3DFB7841.F898C02@t-online.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.t-online.com 1039890587 06 17444 O2i6EkQESlAya6 021214 18:29:47 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:31814 Date: 2002-12-14T19:28:17+01:00 List-Id: 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. with Interfaces.C; use Interfaces.C; with Text_IO; use Text_IO; procedure Test is type BYTE is new Interfaces.C.Unsigned_Char; type Fac_Conf_Struct is record Struct_Length : BYTE; Filler : String (1..32); end record; X : Fac_Conf_Struct; begin Put_Line ("Struct_Length=" & Integer'Image (Fac_Conf_Struct'Size / 8)); X.Struct_Length := 33; X.Struct_Length := (Fac_Conf_Struct'Size / 8); -- Value is 33, too. But - constraint_error is raised end Test;