http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47925
Summary: delete_trivially_dead_insns mishandles volatile mems Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: rsand...@gcc.gnu.org Created attachment 23494 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23494 Simple x86_64 testcase. If we have a sequence like: (set (reg A) ...) (set (reg A) (mem/v (reg A))) then a long-standing bug in delete_trivially_dead_insns will cause it to delete the first instruction. The attached testcase fails on x86_64 at -O and above. The bug is in old code, so the failure in the testcase seems to go back to at least 4.1. However, a combination of factors means that it also shows up as a wrong-code regression in Qt using Linaro GCC 4.5. I've not yet been able to find a specific testcase that regresses in FSF GCC 4.5.