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: 7 May 2004 01:58:08 -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-07 01:58 -------
(In reply to comment #5)
> Read the following:
> http://gcc.gnu.org/ml/gcc/2003-06/msg00436.html
> http://gcc.gnu.org/ml/gcc/2003-06/msg00447.html
> Basically in a future version of GCC it will not work as expected.
Here's another approach to the problem:
__attribute__((naked))
void thunk() {
asm volatile(
" stmfd sp!, {r0, r1, r2, r3, ip, lr, pc}\n"
);
asm volatile(
" b overlayLoader\n"
: : "r"(exampleFunction) : "cc"
);
}
The above example does the prologue code in a separate asm(), so that
the "ldr" instruction is valid when the compiler inserts it. This
code doesn't generate any warnings, and the output looks like this:
stmfd sp!, {r0, r1, r2, r3, ip, lr, pc}
ldr r1, .L3 @ <-- loaded by GCC
b overlayLoader
.L3:
.word _Z15exampleFunctionv
However, there is no guarantee that the "r1" register will be selected.
If you know of a way to constrain an asm() parameter to a specific
ARM register, then this solution would be workable for me.
BTW thank you guys for your help on this problem.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15306