For the testcase int x; int foo(void) { x = 0; return *(volatile int *)&x; }
the tree-optimizers omit the volatile cast and cprop 0 to the return statement which is invalid. This is a regression from 3.4 where we produced (with -O) foo: pushl %ebp movl %esp, %ebp movl $0, x movl x, %eax popl %ebp ret and now foo: pushl %ebp movl %esp, %ebp movl $0, x movl $0, %eax popl %ebp ret -- Summary: [3.4 regression] Casts in folding *& omitted Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rguenth at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21568