This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug inline-asm/15306] Spurious "use of memory input without lvalue" warning
- From: "pgonzalez at bluel dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 May 2004 22:02:32 -0000
- Subject: [Bug inline-asm/15306] Spurious "use of memory input without lvalue" warning
- References: <20040506051145.15306.pgonzalez@bluel.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pgonzalez at bluel dot com 2004-05-06 22:02 -------
(In reply to comment #3)
> A better way is have a tempary const variable holding the function address:
which works by the way:
> void exampleFunction() {
> }
> const void (*temp) () = exampleFunction;
I think what you meant to write was "void (*const temp) () = exampleFunction;".
Otherwise (in C++ at least) the "const" will modify the return value of
the function pointer type, not the pointer itself.
The example you gave compiles without warnings because it inserts
"ldr r3, .L3" before the "stmfd" line (similar to the "p" constraint),
but this is not legal in a naked function because "r3" has not been
pushed on the stack yet.
On the other hand, when "const" is applied to the pointer, the generated
assembly is correct, but I still get the warning.
Does anyone know WHY this approach was "deprecated"? Is there actually
something problematic here? I've been using this feature to do a fairly
seamless implementation of overlay functions on several different
versions of GCC, and I've never had any trouble with it.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15306