http://llvm.org/bugs/show_bug.cgi?id=2182
Summary: wrong code emitted for volatile accesses
Product: new-bugs
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: new bugs
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]
CC: [email protected]
This is for:
[EMAIL PROTECTED]:~/volatile/tmp0$ llvm-gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../configure
--prefix=/home/regehr/llvm-gcc4.2-2.2.source/obj/../install
--enable-llvm=/home/regehr/llvm-2.2 --enable-languages=c,c++
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5546) (LLVM build)
This code:
volatile int x;
void loop_2 (void) {
int i;
for (i=0; i<4; i++) {
x = x+3;
}
}
Compiled like this:
llvm-gcc -O2 -S foo.c
Turns into:
loop_2:
pushl %ebp
movl %esp, %ebp
movl x, %eax
leal 3(%eax), %ecx
movl %ecx, x
leal 6(%eax), %ecx
movl %ecx, x
leal 9(%eax), %ecx
movl %ecx, x
addl $12, %eax
movl %eax, x
popl %ebp
ret
x must be loaded and stored at each loop iteration. The loads are incorrectly
being optimized away.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs