This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug inline-asm/37195] unrelated variables get the same memory address in inline assembly
- From: "jdemeyer at cage dot ugent dot be" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Sep 2008 18:18:03 -0000
- Subject: [Bug inline-asm/37195] unrelated variables get the same memory address in inline assembly
- References: <bug-37195-16622@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from jdemeyer at cage dot ugent dot be 2008-09-01 18:18 -------
Created an attachment (id=16183)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16183&action=view)
Better and simpler test case
The second test case, asmtest2.i exhibits the bug on even more versions of gcc.
To run the testcase, do
gcc -O1 -save-temps asmtest2.i -o asmtest2
Consider the following piece of inline assembly (the second one of asmtest2.i):
asm("# ASM 2\n"
"movl %5, %2\n"
"movl %4, %0\n"
"movl %0, %1\n"
"movl %3, %0\n"
: "=&a" (c0), "=&rm" (c1), "=&rm" (c2)
: "rm" (b0), "rm" (b1), "0" (b2)
: "cc", "%esi", "%edi", "%edx"
);
gcc 4.3.2 compiles this as
movl %eax, -40(%ebp)
movl -24(%ebp), %eax
movl %eax, -44(%ebp)
movl -40(%ebp), %eax
Note that %2 and %3 are both stored in -40(%ebp). I think this is a bug.
I have tried this with the following versions of gcc, all of which have the
bug: 3.4.6, 4.0.3, 4.1.2, 4.2.4, 4.3.1, 4.3.2
--
jdemeyer at cage dot ugent dot be changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #16123|0 |1
is obsolete| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37195