------- Comment #2 from jason at gcc dot gnu dot org 2009-11-09 17:18 ------- This is happening because in C++ mode the body of bar looks like
D.1729 = foo (); D.1728 = D.1729; whereas in the C front end it looks like D.1986 = foo (); and so gimple_seq_may_fallthru says that the body can fall through in the first case, even though the first statement cannot fall through. This difference seems to be because the INIT_EXPR within the RETURN_EXPR is initializing a temporary in C++ vs. the RESULT_DECL in C. I'm not sure where we ought to be pruning the dead assignment to D.1728, but it doesn't seem like the front end's job. -- jason at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu dot org Component|c++ |tree-optimization http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41905