comp.lang.ada
 help / color / mirror / Atom feed
* strange behavior while compiling code with asm()
@ 2011-05-26 15:10 milouz
  2011-05-26 16:50 ` Simon Wright
  0 siblings, 1 reply; 3+ messages in thread
From: milouz @ 2011-05-26 15:10 UTC (permalink / raw)


Hi all,

There's an unexpected behavior I can't understand when I compile some
Ada code with Asm() directive. In the following example, code compile
with no problem :

  ...
  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"

Someone have an explanation ?



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-05-27 11:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-26 15:10 strange behavior while compiling code with asm() milouz
2011-05-26 16:50 ` Simon Wright
2011-05-27 11:50   ` milouz

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