comp.lang.ada
 help / color / mirror / Atom feed
From: Frode Tenneboe <ft@alne.edh.ericsson.se>
Subject: GNAT: warning: source alignment....
Date: 17 Jan 2001 16:09:48 GMT
Date: 2001-01-17T16:09:48+00:00	[thread overview]
Message-ID: <979748441.912448@edh3> (raw)

In lack of a GNAT specific list, here goes:

I get the following warnings from some legacy code when compilled with GNAT
3.12p:

eh_uif.adb:112:45: warning: source alignment (1) < alignment of "T_WordRec" (2)
eh_uif.adb:113:45: warning: source alignment (1) < alignment of "T_LongRec" (4)
eh_uif.adb:119:47: warning: source alignment (1) < alignment of "T_WordRec" (2)
eh_uif.adb:120:47: warning: source alignment (1) < alignment of "T_LongRec" (4)
eh_uif.adb:163:45: warning: source alignment (1) < alignment of "T_WordRec" (2)
eh_uif.adb:164:45: warning: source alignment (1) < alignment of "T_LongRec" (4)
eh_uif.adb:238:47: warning: source alignment (1) < alignment of "T_WordRec" (2)
eh_uif.adb:239:47: warning: source alignment (1) < alignment of "T_LongRec" (4)

The code (som of it) is as follows:

type T_WordRec is
   record
      w : short_integer;
   end record;
type T_WordPtr is access T_WordRec;
function conv16 is new unchecked_conversion(system.address, T_WordPtr);

WordId : T_WordPtr;
WordId := conv16(UnitId'address);

where UnitId is of:
   type T_UNIT_ITEM is (<>);

I interprete the warning that UnitId is aligned at byte boundaries
whil T_WordRec (nor T_LongRec) is not. Does it make any sense to
use a representation clause on a discrete generic type as above?

Why should the source alignment be an issue here?
I can only find alignment references to target objects - which part of the
RM is this discussed?
What can I do to remove these warnings?

 -Frode
-- 
^ Frode Tenneb�                    | email: ft@edh.ericsson.se      ^
| Ericsson Radar AS. N-1788 Halden |                                |
| Phone: +47 69 21 41 47           | Frode@IRC                      |
| with Standard.Disclaimer; use Standard.Disclaimer;                |



             reply	other threads:[~2001-01-17 16:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-17 16:09 Frode Tenneboe [this message]
2001-01-18  3:35 ` GNAT: warning: source alignment Robert Dewar
2001-01-18 13:46   ` Frode Tenneboe
2001-01-18 15:06     ` Robert Dewar
2001-01-20 19:30   ` DuckE
2001-01-21 16:14     ` Robert Dewar
replies disabled

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