mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-25 16:01:18 +08:00
gimplify: Gimplify value in gimplify_init_ctor_eval_range [PR98353]
gimplify_init_ctor_eval_range wasn't gimplifying value, so if it wasn't a gimple val, verification at the end of gimplification would ICE (or with release checking some random pass later on would ICE or misbehave). 2020-12-21 Jakub Jelinek <jakub@redhat.com> PR c++/98353 * gimplify.c (gimplify_init_ctor_eval_range): Gimplify value before storing it into cref. * g++.dg/opt/pr98353.C: New test.
This commit is contained in:
parent
8cd42d3cc2
commit
a477f1445b
@ -4607,7 +4607,11 @@ gimplify_init_ctor_eval_range (tree object, tree lower, tree upper,
|
|||||||
gimplify_init_ctor_eval (cref, CONSTRUCTOR_ELTS (value),
|
gimplify_init_ctor_eval (cref, CONSTRUCTOR_ELTS (value),
|
||||||
pre_p, cleared);
|
pre_p, cleared);
|
||||||
else
|
else
|
||||||
gimplify_seq_add_stmt (pre_p, gimple_build_assign (cref, value));
|
{
|
||||||
|
if (gimplify_expr (&value, pre_p, NULL, is_gimple_val, fb_rvalue)
|
||||||
|
!= GS_ERROR)
|
||||||
|
gimplify_seq_add_stmt (pre_p, gimple_build_assign (cref, value));
|
||||||
|
}
|
||||||
|
|
||||||
/* We exit the loop when the index var is equal to the upper bound. */
|
/* We exit the loop when the index var is equal to the upper bound. */
|
||||||
gimplify_seq_add_stmt (pre_p,
|
gimplify_seq_add_stmt (pre_p,
|
||||||
|
17
gcc/testsuite/g++.dg/opt/pr98353.C
Normal file
17
gcc/testsuite/g++.dg/opt/pr98353.C
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// PR c++/98353
|
||||||
|
// { dg-do compile { target c++11 } }
|
||||||
|
|
||||||
|
template <int N> struct A {};
|
||||||
|
template <typename T>
|
||||||
|
struct B
|
||||||
|
{
|
||||||
|
static const int n = 1;
|
||||||
|
template <class> A <B<T>::n> foo ();
|
||||||
|
_Complex double c[2], d = 1.0;
|
||||||
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
bar ()
|
||||||
|
{
|
||||||
|
B<int>().foo<int> ();
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user