In some cases in inline asm, an output parameter with no-clobber "=&rm"
constraint gets the same address as an input parameter, even when they refer to
two different C variables.  This seems to happen when the following conditions
are satisfied:

* The variables involved appear only in inline asm (as the output of one asm
statement and the input of a second).
* The output constraint is "=&rm" ("=m" works correctly).
* There are too many clobbered variables forcing some of the output parameters
into memory.

The attached testcase works for i386, x86_64, powerpc and powerpc64.  For other
targets, change the clobber list to include as much registers as possible.
Compile with gcc -O1 -save-temps -c -o bug.o bug.c

Tested with gcc -v:
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc/configure CC=/usr/bin/gcc-4.3.4
--prefix=/home/jdemeyer/local --enable-checking=release
Thread model: posix
gcc version 4.5.0 20090904 (experimental) (GCC)


-- 
           Summary: "=&rm" constraints give overlapping memory addresses
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jdemeyer at cage dot ugent dot be


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

Reply via email to