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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,438f2856ab36a026 X-Google-Attributes: gid103376,public From: stt@houdini.camb.inmet.com (Tucker Taft) Subject: Re: 83/95 issue, bad code or compiler bug Date: 1998/11/19 Message-ID: #1/1 X-Deja-AN: 413671987 Sender: news@inmet.camb.inmet.com (USENET news) X-Nntp-Posting-Host: houdini.camb.inmet.com References: Organization: Intermetrics, Inc. Newsgroups: comp.lang.ada Date: 1998-11-19T00:00:00+00:00 List-Id: Jeff Creem (jeffrey.m.creem@lmco.com) wrote: : type My_Record is : record : My_Field : My_Subtype; : Other_Field : My_Integer_Type; : end record; : for My_Record use : record : My_Field at 0 range 0 .. 31; : Other_Field at 4 range 0 .. 31; : end record; : for My_Record'size use 2 * 32; : with the old compiler the My_Subtype was still using all 32 bits so : that if we had a record with My_Field := 1 and Other_Field := 2 and : we looked at the bytes in memory associated with this record we would see : 00 00 00 01 : 00 00 00 02 : But with this new compiler (happens to be ada 95) I get : 01 00 00 00 : 00 00 00 02 : I suspect that the compiler is seeing that the 'size of My_Subtype is 8 and : so then even though I have the record rep-spec it does not feel constrained to : put this 8 bit value in any particular place in the 32 bits I have given it : since the field is larger than the subtype requires. : Yuck. This is a bug. You should ask your compiler vendor whether a fix is available. The repclause clearly indicates that My_Field should occupy 4 bytes, and that means it should not just be using the high 8 bits of the word. : Thanks, : Jeff -- -Tucker Taft stt@inmet.com http://www.inmet.com/~stt/ Intermetrics, Inc. Burlington, MA USA An AverStar Company