While fixing bug 21173 and 20963, it was noticed that force_gimple_operand destroys trees passed to it. This is a very surprising result, and was the actual underlying cause of those bugs.
(the testcase in g++.dg/tree-ssa/pr20963.C shows this) a debugging session: Breakpoint 3, create_expression_by_pieces (block=0x400c4870, expr=0x88403f0, stmts=0x400c6510) at tree-ssa-pre.c:1322 expr came from a node in ANTIC_IN, we *can't* modify it, because it's not a copy. (gdb) p debug_generic_stmt (expr) (charD.3 *) &0B->typeD.1681; ... 1388 newexpr = force_gimple_operand (expr, (gdb) n 1390 if (forced_stmts) (gdb) p debug_generic_stmt (expr) (charD.3 *) &D.1708_3->typeD.1681; -- Summary: force_gimple_operand destroys trees passed to it Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dberlin at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21236