comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: GNAT 4.4.5 Record Bit_Order Endian issues
Date: Thu, 17 Jan 2013 20:58:03 +0000
Date: 2013-01-17T20:58:03+00:00	[thread overview]
Message-ID: <ly38xzv86c.fsf@pushface.org> (raw)
In-Reply-To: 0169b2ea-30b4-45d1-a4d4-c5841e54b9ad@googlegroups.com

awdorrin <awdorrin@gmail.com> writes:

> So, now on Debian 7 with GNAT 4.6.
>
> Current record definition starts with:
>
>   for MY_RECORD_TYPE'Bit_Order use System.High_Order_First;
>   for MY_RECORD_TYPE use
>     record
>       TRACK_ID_X                  at   0 range  0 .. 11;
>       TRACK_ID_USE_COUNTR_X       at   0 range 12 .. 17;
>       NORMAL_RAW_DATA_X           at   0 range 18 .. 18;
>       TRACK_STATUS_X              at   0 range 19 .. 21;
>       DEAD_RECKONING_FLG_X        at   0 range 22 .. 22;
>       TRACK_CONVERGENCE_X         at   0 range 23 .. 23;
>       BLOCKED_TRACK_FLAG_X        at   0 range 24 .. 24;
>       TRACK_INRFRNCE_ALRT_X       at   0 range 25 .. 25;
>       MNUVRING_TARGET_FLG_X       at   0 range 26 .. 26;
>       DESGNATED_TRACK_FLG_X       at   0 range 27 .. 27;
>       SPAREA                      at   0 range 28 .. 31;
>    end record;
>
> Within my code, I have something like:
>   MY_TRK_REC.TRACK_ID_X := 1;
>   MY_TRK_REC.TRACK_ID_USE_COUNTR_X :=1;
>
> Examining things through GDB:
>
> "p MY_TRK_REC.TRACK_ID_X'Address" returns 0xb5cd0cd2
> "p MY_TRK_REC.SPAREA'Address" returns 0xb5cd0cd0
>
> The record elements are being laid out backwards in memory, despite
> the use System.High_Order_First directive.

That is *because of* the use of the Bit_Order clause.

If you comment-out the Bit_Order clause and do the same, you'll find
that My_Trk_Rec.Track_Id_X'Address is the same as My_Trk_Rec'Address,
and My_Trk_Rec.Sparea'Address is 3 greater.



  parent reply	other threads:[~2013-01-17 20:58 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-14 17:43 GNAT 4.4.5 Record Bit_Order Endian issues awdorrin
2013-01-15  0:38 ` Randy Brukardt
2013-01-15  1:57 ` Adam Beneschan
2013-01-15 16:57 ` AdaMagica
2013-01-15 22:24 ` Stephen Leake
2013-01-16 10:44   ` Simon Wright
2013-01-16 19:00     ` AdaMagica
2013-01-16 21:34       ` Simon Wright
2013-01-16 23:14     ` Randy Brukardt
2013-01-17  3:49     ` Stephen Leake
2013-01-17 15:32       ` awdorrin
2013-01-18  9:49         ` Stephen Leake
2013-01-18 13:04           ` Robert A Duff
2013-01-19  1:43             ` Stephen Leake
2013-01-19 12:48               ` AdaMagica
2013-01-22  0:14                 ` Randy Brukardt
2013-01-17 17:28       ` Simon Wright
2013-01-18  9:56         ` Stephen Leake
2013-01-17 18:04 ` awdorrin
2013-01-17 19:50   ` awdorrin
2013-01-18  9:58     ` Stephen Leake
2013-01-17 20:58   ` Simon Wright [this message]
2013-01-17 21:29     ` awdorrin
2013-01-17 22:16       ` awdorrin
2013-01-18  6:15         ` J-P. Rosen
2013-01-18 15:28           ` Niklas Holsti
2013-01-18  9:37         ` Stephen Leake
2013-01-18 12:24         ` awdorrin
2013-01-18 15:11           ` awdorrin
2013-01-19  1:48             ` Stephen Leake
2013-01-18 17:19           ` Simon Wright
2013-01-22  9:49           ` quinot
2013-01-28 13:39             ` quinot
  -- strict thread matches above, loose matches on Subject: below --
2013-01-22  3:21 Stephen Leake
2013-01-22  5:14 ` Jeffrey Carter
2013-01-23  1:29   ` Stephen Leake
2013-01-22 22:40 ` Randy Brukardt
2013-01-23  1:38   ` Stephen Leake
2013-01-23 10:58     ` Simon Wright
replies disabled

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