[Bug c++/49165] [4.3/4.4/4.5/4.6/4.7 Regression] ICE on for-loop/throw combination
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed May 25 19:51:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49165
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-05-25 19:47:52 UTC ---
--- gimplify.c (revision 174199)
+++ gimplify.c (working copy)
@@ -2848,7 +2848,7 @@
default:
/* Other expressions that get here must have boolean values, but
might need to be converted to the appropriate mode. */
- if (type == boolean_type_node)
+ if (type == boolean_type_node || type == void_type_node)
return expr;
return fold_convert_loc (loc, boolean_type_node, expr);
}
fixes the ICE, but we error out then still during gimplification:
error: using result of function returning ‘void’
I think the only problematic case is when one COND_EXPR arm is THROW_EXPR (i.e.
void_type_node) and the other one has gimple reg type. Either the FE
(genericization or during gimplification) should replace THROW_EXPR with
COMPOUND_EXPR <THROW_EXPR, <fold_convert <type, integer_zero_node>>>, or
gimplifier needs to special case it in some places. Is the only possibility to
create COND_EXPR in C++ with void_type_node on one arm and some other type on
the other arm and COND_EXPR itself a throw?
More information about the Gcc-bugs
mailing list