From: awdorrin <awdorrin@gmail.com>
Subject: misaligned actual cannot be passed by reference
Date: Tue, 6 Dec 2011 06:14:45 -0800 (PST)
Date: 2011-12-06T06:14:45-08:00 [thread overview]
Message-ID: <625d37e2-4b4b-44a8-bafb-48555713802f@d17g2000yql.googlegroups.com> (raw)
I have the following record definition that is used as a shared data
area:
type FP_SHARED_BUF_TYPE is
record
-- POSIX.Mutexes
LOCK_SHM_ACT_NRT : Mutex;
LOCK_SHM_ACT_RT : Mutex;
LOCK_SHM_EXIT_NRT : Mutex
LOCK_SHM_EXIT_RT : Mutex;
LOCK_SHM_RT_STATUS : Mutex;
LOCK_SHM_NRT_STATUS : Mutex;
LOCK_SHM_NRT_FILENAME : Mutex;
LOCK_SHM_REINIT_FLAG : Mutex;
LOCK_ERROR : Mutex;
FP_PIDS : FP_PID_ARRAY_TYPE := (others => 0);
CYCLE_CTR : INT32 := 0;
CMN_SHM_READY : INT8;
MSCS_PER_SEC : INT8;
CURRENT_AC_TYPE : GLOBAL_TYPES.AIRCRAFT_TYPE :=
GLOBAL_TYPES.NONE;
SIM_STATUS : INT32 := 0;
CHAN_RATES : M1553_RATE_TYPE;
DCFSHM : DCFSHM_TYPE;
ERRORS_SHM : ERRORS_SHM_TYPE;
PERFORMANCE : PERFORM_ARRAY_TYPE;
LOCK_MISSION_VARS : Mutex;
MISSION_START_TIME : INT32;
MISSION_TIME : INT32;
MISSION_FRAME_COUNT : INT32;
LOCK_BUS_DATA : Mutex;
LOCK_CHNG_SCREEN : Mutex;
LOCK_STACK_DATA : Mutex;
LOCK_START_TIME : Mutex;
LOCK_SHM_TC_UPDATE : Mutex;
LOCK_UPDATE_RATE : Mutex;
OISHM : OISHM_TYPE;
LOCK_NAV : Mutex;
LOCK_PB : Mutex;
NAV : NAV_SHM_TYPE;
NAV_SERV : NAV_SERV_REQ_TYPE;
PB : PB_SHM_TYPE;
MISSION_DESC : MISSION_DESC_TYPE;
COMPANION_ID : INT32;
CAPTURE_TIME : INT32;
end record;
Compiling with the -gnatR3 option I get the following rep spec:
for FP_SHARED_BUF_TYPE'Size use 7693248;
for FP_SHARED_BUF_TYPE'Alignment use 8;
for FP_SHARED_BUF_TYPE use record
LOCK_SHM_ACT_NRT at 0 range 0 .. 255;
LOCK_SHM_ACT_RT at 32 range 0 .. 255;
LOCK_SHM_EXIT_NRT at 64 range 0 .. 255;
LOCK_SHM_EXIT_RT at 96 range 0 .. 255;
LOCK_SHM_RT_STATUS at 128 range 0 .. 255;
LOCK_SHM_NRT_STATUS at 160 range 0 .. 255;
LOCK_SHM_NRT_FILENAME at 192 range 0 .. 255;
LOCK_SHM_REINIT_FLAG at 224 range 0 .. 255;
LOCK_ERROR at 256 range 0 .. 255;
FP_PIDS at 288 range 0 .. 511;
CYCLE_CTR at 352 range 0 .. 31;
CMN_SHM_READY at 356 range 0 .. 7;
MSCS_PER_SEC at 357 range 0 .. 7;
CURRENT_AC_TYPE at 358 range 0 .. 7;
SIM_STATUS at 360 range 0 .. 31;
CHAN_RATES at 364 range 0 .. 127;
DCFSHM at 380 range 0 .. 196255;
ERRORS_SHM at 24912 range 0 .. 219903;
PERFORMANCE at 52400 range 0 .. 20479;
LOCK_MISSION_VARS at 54960 range 0 .. 255;
MISSION_START_TIME at 54992 range 0 .. 31;
MISSION_TIME at 54996 range 0 .. 31;
MISSION_FRAME_COUNT at 55000 range 0 .. 31;
LOCK_BUS_DATA at 55008 range 0 .. 255;
LOCK_CHNG_SCREEN at 55040 range 0 .. 255;
LOCK_STACK_DATA at 55072 range 0 .. 255;
LOCK_START_TIME at 55104 range 0 .. 255;
LOCK_SHM_TC_UPDATE at 55136 range 0 .. 255;
LOCK_UPDATE_RATE at 55168 range 0 .. 255;
OISHM at 55200 range 0 .. 703;
LOCK_NAV at 55288 range 0 .. 255;
LOCK_PB at 55320 range 0 .. 255;
NAV at 55352 range 0 .. 799999;
NAV_SERV at 155352 range 0 .. 48063;
PB at 161360 range 0 .. 6401407;
MISSION_DESC at 961536 range 0 .. 895;
COMPANION_ID at 961648 range 0 .. 31;
CAPTURE_TIME at 961652 range 0 .. 31;
end record;
Since I have a struct defined in C code which must map this, I don't
want the GNAT compiler moving things around in future builds, so I cut
and pasted this rep spec into the Ada code.
The next time I compile, I get the error message mentioned in the
subject:
"misaligned actual cannot be passed by reference"
There are several locations in the code being flagged but an example
is:
POSIX.Mutexes.Lock( POSIX.Mutexes.Descriptor_Of( CMN_SHM.LOCK_MISSION_VARS ) );
Looking at the LOCK_MISSION_VARS in the rep spec, it is defined as:
LOCK_MISSION_VARS at 54960 range 0 .. 255;
54960 is an 8 byte boundary, so I am not sure why GNAT thinks this is
misaligned, especially since this error is not flagged if I do not
include the rep spec in the code.
next reply other threads:[~2011-12-06 14:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-06 14:14 awdorrin [this message]
2011-12-06 21:53 ` misaligned actual cannot be passed by reference awdorrin
2011-12-07 14:47 ` Robert Matthews
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox