comp.lang.ada
 help / color / mirror / Atom feed
From: milouz <a.michelizza@gmail.com>
Subject: strange behavior while compiling code with asm()
Date: Thu, 26 May 2011 08:10:11 -0700 (PDT)
Date: 2011-05-26T08:10:11-07:00	[thread overview]
Message-ID: <d54bc221-6673-427f-ac5f-59386cdfc50d@e21g2000vbz.googlegroups.com> (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 ?



             reply	other threads:[~2011-05-26 15:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-26 15:10 milouz [this message]
2011-05-26 16:50 ` strange behavior while compiling code with asm() Simon Wright
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