From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,NICE_REPLY_A,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Rod Kay Newsgroups: comp.lang.ada Subject: Re: Using pointers with inline assembly in Ada Date: Fri, 10 Jun 2022 15:24:35 +1000 Organization: A noiseless patient Spider Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 10 Jun 2022 05:28:14 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="eeb844e01c63fc18280f71d34dd7074e"; logging-data="7337"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/MSgvRIgi30U96ozOa4cm/3LSPDcFjPXE=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Cancel-Lock: sha1:zLW0oyU1DCOk4qT/ZGgiFaMJflM= In-Reply-To: Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:63959 List-Id: On 10/6/22 07:30, NiGHTS wrote: > declare > type ff is array (0 .. 10) of Unsigned_32; > pragma Pack(ff); > Flags : aliased ff := (others => 0); > Flag_Address : System.Address := Flags'Address; > begin > Asm ( "movl %0, %%eax" & > "movl $1, (%%eax)" , > Inputs => System.Address'Asm_Input ("g", Flag_Address), > Clobber => "eax", > Volatile => true > ); > Put_Line ("Output:" & Flags(0)'Img); > end; > If you are on a 64 bit machine, then I expect 'pragma Pack' might be the problem, as 2 consecutive array elements will fir into a single address. Also, possibly use ... Flag_Address : System.Address := Flags (Flags'First)'Address; Regards.