From: Simon Wright <simon@pushface.org>
Subject: Re: strange behavior while compiling code with asm()
Date: Thu, 26 May 2011 17:50:43 +0100
Date: 2011-05-26T17:50:43+01:00 [thread overview]
Message-ID: <m262ox76e4.fsf@pushface.org> (raw)
In-Reply-To: d54bc221-6673-427f-ac5f-59386cdfc50d@e21g2000vbz.googlegroups.com
milouz <a.michelizza@gmail.com> writes:
> procedure Main is
> Foo : Integer;
> begin
> Foo := 1; -- Foo is initialized here !
> System.Machine_Code.Asm(
> "movl %0, %%eax",
> Inputs => Integer'Asm_Input("m", Foo),
> Volatile => True
> );
> ...
>
> Why no trying to initialize `Foo' variale during its declaration ? The
> code is exactly the same except for `Foo' :
>
> procedure Main is
> Foo : Integer := 1; -- Foo is initialized here !
> begin
>
>
> But then, compilation fails with that message : "error: memory input 0
> is not directly addressable"
Here (GCC 4.6.0) I get
gnatmake -c -u -f milouz.adb
gcc -c milouz.adb
milouz.adb: In function 'Milouz':
milouz.adb:13:23: warning: use of memory input without lvalue in asm operand 0 is deprecated [enabled by default]
but this goes away if instead of "m" I use "g". I suppose that the first
form places Foo in memory, while the second places it in a register,
which won't work with the "m" constraint
(http://gcc.gnu.org/onlinedocs/gcc-4.6.0/gcc/Simple-Constraints.html)
next prev parent reply other threads:[~2011-05-26 16:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-26 15:10 strange behavior while compiling code with asm() milouz
2011-05-26 16:50 ` Simon Wright [this message]
2011-05-27 11:50 ` milouz
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox