This is correct as you are just using the address and not the contents itself. This is how inline-asm is documented to work also.

-- Andrew Pinski

Sent from my iPhone

On Jun 25, 2008, at 19:08, "aoliva at gcc dot gnu dot org" <[EMAIL PROTECTED] > wrote:

This is originally derived from code from Linux, in which the physical address of a structure is passed to an asm statement as an integral type, causing the
initializer of the structure to be optimized away.

int main() { int i = 0x12345678; long j = (long)&i; asm ("# %0" : : "r" (j)); }

int main() { int i = 0x12345678; void *j = &i; asm ("#" : : "p" (j)); }

At the very least in the second case above, the compiler should mark the asm statement as a VUSE of i. Arguably, it should do so in the former case as well, like it does for pointers passed to function calls as integral types.


--
Summary: pointer referenced in asm statement not regarded as VUSE
          Product: gcc
          Version: 4.3.1
           Status: UNCONFIRMED
         Severity: normal
         Priority: P3
        Component: inline-asm
       AssignedTo: unassigned at gcc dot gnu dot org
       ReportedBy: aoliva at gcc dot gnu dot org
GCC build triplet: *-*-*
 GCC host triplet: *-*-*
GCC target triplet: *-*-*


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36639

Reply via email to