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 c/15306] New: Spurious "use of memory input without lvalue" warning


The code below compiled without problems on previous versions of GCC,
but starting with GCC 3.4.0 I now get the following warning:

Test.cpp:11: warning: use of memory input without lvalue in asm operand 0 is 
deprecated

The problem I'm trying to solve is to load a function address
into a register before jumping to an assembly language handler.
This needs to occur from an asm() block because the actual code
is produced by C macros for implementing memory overlays on
an embedded system.

I've tried using other constraints instead of "m".  For example,
with "g", you get the invalid code "ldr r1, #_Z15exampleFunctionv".
With "p" the compiler loads the address into a register before the
"stmfd", which is not legal because this is a naked function that
is setting up the stack for the loader (which is hand-coded in
assembly).

I'm not sure I understand exactly what a "memory input without lvalue" is,
but unless there's another approach to this, I think maybe not it should not
be deprecated.

__________________

void exampleFunction() {
}

__attribute__((naked))
void thunk() {
  asm volatile(
"	stmfd	sp!, {r0, r1, r2, r3, ip, lr, pc}\n"
"	ldr	r1, %0\n"
"	b	overlayLoader\n"
    : : "m"(exampleFunction) : "cc"
  );
}

-- 
           Summary: Spurious "use of memory input without lvalue" warning
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pgonzalez at bluel dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-cygwin
  GCC host triplet: i686-pc-cygwin
GCC target triplet: arm-arm-elf


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]