This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug inline-asm/15306] Spurious "use of memory input without lvalue" warning


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]