I think the subject says what causes the problem and the reason why we don't fold *&a into a[0] is because fold does not handle it but fold_stmt does. So what I did was to patch remove_useless_stmts_1 to do the folding for us (this is already done for the second testcase in the PR, for MODIFY_EXPR). I also removed the case for SWITCH_EXPR in remove_useless_stmts_1 because it was not needed at all and just slowed us down. OK? Bootstrapped and tested on powerpc-darwin. ChangeLog: * tree-cfg.c (remove_useless_stmts_1) : Don't fold statement. : Fold the statement. testsuite/ChangeLog: * gcc.c-torture/compile/pr17529.c: Remove the xfail.