------- Comment #9 from rakdver at gcc dot gnu dot org 2006-01-02 18:34 ------- As the comments in gimplify_cleanup_point_expr indicate, it only handles cases when cleanup_exprs are not within nested constructs (with the exception of conditions).
In this PR, the code basically looks like cleanup_point_expr { ... try { tmp = b ? target_expr (bla1, something, cleanup1) : target_expr (bla2, something, cleanup2) } catch {...} throw (tmp); } The target_exprs expand cleanups to cleanup_exprs, that however are not spotted by gimplify_cleanup_point_expr, since they are within try_catch_expr. The reason why this does not reproduce without the test for b is that then the code looks like cleanup_point_expr { ... try { tmp = target_expr (bla1, something, cleanup1); } catch {...} throw (tmp); } and there is another bug in gimplify_modify_expr_rhs that causes cleanup1 to be ignored. Fixing this seems to need a complete rewrite of gimplify_cleanup_point_expr. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24996