comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Erroneous code generation from GNAT or GCC?
Date: Tue, 30 Apr 2013 20:06:09 +0100
Date: 2013-04-30T20:06:09+01:00	[thread overview]
Message-ID: <lyr4hrrg7y.fsf@pushface.org> (raw)
In-Reply-To: op.wwc5o9boule2fv@cardamome

"Yannick Duchêne (Hibou57)" <yannick_duchene@yahoo.fr> writes:

> So when the RM says "if a subprogram_body contains any
> code_statements", what is the subject sub‑program body? I though it
> was the body containing the 'Asm' sub‑program. Or may be it's the
> 'Asm' sub‑program itself?

The whole thing is bizarre: code statements are written using the form
of a qualified expression though clearly not a qualified expression
since it can't be assigned anywhere!

Each qualified expression typically represents one machine code
instruction or assembly directive.

If you are implementing a function using code statements you are
expected to know the calling convention, so that you can return the
result in the corrct way.

Clearly none of these apply to the code you wrote, so - I think - GNAT
takes advantage of the implementation permission in ARM13.8(11) [1] to
support intrinsic subprograms without all those tiresome restrictions.

As described in [2].

[2] also recommends using Volatile => True in most circumstances.

> That's not a big issue, that's just that I prefer to stick to the RM
> when feasible, and if I have to write things a different way to
> conform to the RM, I will do so.

Since everything to do with code statements/intrinsic subprograms is
compiler- and target-dependent, I don't see what you gain by this!

I was wondering what you meant by using constraints "a", "b", "c", "d"
.. I now see [3] that these are i386 constraints for the a..d registers
respectively, no wonder they gave wierd results on x86_64 where they
mean something quite different!

[1] http://www.ada-auth.org/standards/12rm/html/RM-13-8.html#p11
[2]
http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gnat_rm/Machine-Code-Insertions.html
[3] http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Machine-Constraints.html



  reply	other threads:[~2013-04-30 19:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-27 21:08 GNAT not generating any code for sub‑program: known bug? Yannick Duchêne (Hibou57)
2013-04-27 22:22 ` Yannick Duchêne (Hibou57)
2013-04-27 23:48   ` Yannick Duchêne (Hibou57)
2013-04-28  7:14   ` Simon Wright
2013-04-28 17:52     ` Yannick Duchêne (Hibou57)
2013-04-28 19:27       ` Yannick Duchêne (Hibou57)
2013-04-28 20:46         ` Simon Wright
2013-04-28 20:43       ` Simon Wright
2013-04-28 22:35 ` Erroneous code generation from GNAT or GCC? Yannick Duchêne (Hibou57)
2013-04-28 22:49   ` Yannick Duchêne (Hibou57)
2013-04-28 23:52   ` Yannick Duchêne (Hibou57)
2013-04-29  1:35     ` Yannick Duchêne (Hibou57)
2013-04-30  0:48       ` Yannick Duchêne (Hibou57)
2013-04-30  6:40         ` Simon Wright
2013-04-30 17:04           ` Yannick Duchêne (Hibou57)
2013-04-30 19:06             ` Simon Wright [this message]
2013-04-30 21:28               ` Yannick Duchêne (Hibou57)
2013-04-30 22:22                 ` Simon Wright
2013-05-01 18:19               ` J-P. Rosen
replies disabled

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