This is a follow-up on bug 33291. It uses the same testcase (repeated here) but with some additional optimization flags.
------------------------------------------- struct Clock { void f(); void add(unsigned n) { a += n; } int a; }; struct CPU : Clock { virtual ~CPU(); unsigned char readSlow(); void execute(); void delay() { add(2); } unsigned char readFast() { if (unsigned char* p = ptrs[addr >> 8]) { // fast-path delay(); delay(); return p[addr & 255]; } else { // slow-path return readSlow(); } } typedef void (CPU::*FuncPtr)(); static FuncPtr tab[256]; unsigned char* ptrs[256]; unsigned addr; }; void CPU::execute() { f(); while (true) { unsigned char b = readFast(); delay(); (this->*tab[b])(); } } ---------------------------------------- When compiled with SVN revision 128074 on a linux x86_64 machine: > g++ -O3 -fforce-addr -ftracer -S CPU.ii > cat CPU.s ... movl (%rbx), %eax leal 4(%rax), %edx addl $6, %eax movl %edx, (%rbx) #### dead store movzbl (%r12), %edx movzbl (%rcx,%rdx), %edx movl %eax, (%rbx) ... -- Summary: follow-up on bug 33291 dead-store not eliminated Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: wouter dot vermaelen at scarlet dot be http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33302