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


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