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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8f1678ed8a8a296d,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.0.170 with SMTP id 10mr26997401pbf.2.1323180887056; Tue, 06 Dec 2011 06:14:47 -0800 (PST) Path: lh20ni75962pbb.0!nntp.google.com!news2.google.com!postnews.google.com!d17g2000yql.googlegroups.com!not-for-mail From: awdorrin Newsgroups: comp.lang.ada Subject: misaligned actual cannot be passed by reference Date: Tue, 6 Dec 2011 06:14:45 -0800 (PST) Organization: http://groups.google.com Message-ID: <625d37e2-4b4b-44a8-bafb-48555713802f@d17g2000yql.googlegroups.com> NNTP-Posting-Host: 192.31.106.35 Mime-Version: 1.0 X-Trace: posting.google.com 1323180886 30393 127.0.0.1 (6 Dec 2011 14:14:46 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 6 Dec 2011 14:14:46 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: d17g2000yql.googlegroups.com; posting-host=192.31.106.35; posting-account=YkFdLgoAAADpWnfCBA6ZXMWTz2zHNd0j User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HUALESRCNK X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20100101 Firefox/8.0,gzip(gfe) Xref: news2.google.com comp.lang.ada:14857 Content-Type: text/plain; charset=ISO-8859-1 Date: 2011-12-06T06:14:45-08:00 List-Id: 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.