From: Jakub Jelinek Date: Mon, 18 Jul 2016 18:40:12 +0000 (+0200) Subject: re PR c++/71822 (ICE: in gimplify_expr, at gimplify.c:11025) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f4d902955b3d123937ab85866c51f9b665591604;p=gcc.git re PR c++/71822 (ICE: in gimplify_expr, at gimplify.c:11025) PR c++/71822 * cp-gimplify.c (cp_gimplify_expr) : Recursively fold *expr_p before genericizing it. * g++.dg/template/defarg21.C: New test. From-SVN: r238440 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 888d4aa894c..3cd6b133869 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2016-07-18 Jakub Jelinek + PR c++/71822 + * cp-gimplify.c (cp_gimplify_expr) : Recursively + fold *expr_p before genericizing it. + PR c++/71871 * typeck.c (build_x_conditional_expr): Revert the 2012-10-25 change. diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 8496d7cfee7..de6c9296aa8 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -621,6 +621,8 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) init, VEC_INIT_EXPR_VALUE_INIT (*expr_p), from_array, tf_warning_or_error); + hash_set pset; + cp_walk_tree (expr_p, cp_fold_r, &pset, NULL); cp_genericize_tree (expr_p); ret = GS_OK; input_location = loc; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index aa35fb2033b..2f6471a6c6b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2016-07-18 Jakub Jelinek + PR c++/71822 + * g++.dg/template/defarg21.C: New test. + PR c++/71871 * g++.dg/ext/vector31.C: New test. diff --git a/gcc/testsuite/g++.dg/template/defarg21.C b/gcc/testsuite/g++.dg/template/defarg21.C new file mode 100644 index 00000000000..6ac227665ef --- /dev/null +++ b/gcc/testsuite/g++.dg/template/defarg21.C @@ -0,0 +1,21 @@ +// PR c++/71822 +// { dg-do compile } + +int bar (int); + +template +struct A +{ + explicit A (int x = bar (sizeof (T))); +}; + +struct B +{ + A b[2]; +}; + +void +baz () +{ + B b; +}