http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56999
Bug #: 56999 Summary: [4.8/4.9 Regression] LRA caused miscompilation of xulrunner Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: rtl-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: ja...@gcc.gnu.org CC: vmaka...@gcc.gnu.org With -fpic -O2 -m32 -march=i686 -mtune=atom the following testcase is miscompiled with LRA (but, I don't have a runtime testcase, just eyeball assembly right now). The bad code is: movl 24(%esp), %eax addl $12, %eax movl %eax, 24(%esp) addl $8, %eax testb %cl, %cl movl 24(%esp), %ecx cmovne %ecx, %eax movl %eax, 24(%esp) while reload has: movl %ecx, %eax addl $8, %ecx addl $12, %eax cmpb $0, 23(%esp) cmove %ecx, %eax instead. So, reload performs the intentional ptr + (flag ? 12 : 8) while the LRA code performs ptr + (flag ? 12 : 20) instead. The source code related to this is barriers ? &mJITInfo->jitHandleCtorBarriered : &mJITInfo->jitHandleCtor where offsetof (JITScriptSet, jitHandleCtorBarriered) == 12 and offsetof (JITScriptSet, jitHandleCtor) is 8, there is no field at offset 20.