diff options
author | Jakub Jelinek <jakub@redhat.com> | 2020-12-22 00:01:34 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2020-12-22 00:01:34 +0100 |
commit | a477f1445b3093d01e68cd4c096c5776ad769e11 (patch) | |
tree | bd22d2e33e4b72ccdd2652dbeb6eacaf100ba139 /gcc/gimplify.c | |
parent | 8cd42d3cc2461df394c718afc270574a061a6ef6 (diff) | |
download | gcc-a477f1445b3093d01e68cd4c096c5776ad769e11.zip gcc-a477f1445b3093d01e68cd4c096c5776ad769e11.tar.gz gcc-a477f1445b3093d01e68cd4c096c5776ad769e11.tar.bz2 |
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.
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index ea8a53e..46f726a 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -4607,7 +4607,11 @@ gimplify_init_ctor_eval_range (tree object, tree lower, tree upper, gimplify_init_ctor_eval (cref, CONSTRUCTOR_ELTS (value), pre_p, cleared); 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. */ gimplify_seq_add_stmt (pre_p, |