------- Comment #3 from aoliva at gcc dot gnu dot org 2010-04-15 11:34 ------- Created an attachment (id=20387) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20387&action=view) Patch that fixes this instance of the problem
I'm not convinced we have a bug here. The transformations are all correct, and the unfortunate result is that the variable is completely optimized away. Saying so is fine. That said, it is indeed possible to change tree-ssa-reassoc so that the new stmts are inserted after the debug stmt at hand. I get the impression this would always be safe to do, but it feels like a bit of a waste of effort, and it would hardly fix more general situations, and it might choose an insertion point that is just as unfortunate, and perhaps more surprising. Anyhow, this is the patch I'm testing now. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43478