aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2020-02-07 16:10:18 -0500
committerJason Merrill <jason@redhat.com>2020-02-08 11:14:58 -0500
commitc151a342b8bae48ce4c864e67913bc3a0346c4c7 (patch)
tree38af6c931eb79a59c347f031e3b409a89c549485 /gcc
parentc7c09af8ef0fe6671c7733d4d67bb73ecf10fc1b (diff)
downloadgcc-c151a342b8bae48ce4c864e67913bc3a0346c4c7.zip
gcc-c151a342b8bae48ce4c864e67913bc3a0346c4c7.tar.gz
gcc-c151a342b8bae48ce4c864e67913bc3a0346c4c7.tar.bz2
c++: Fix TREE_SIDE_EFFECTS after digest_init.
* typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS if appropriate.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/typeck2.c8
2 files changed, 11 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9205b20..a0542b2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2020-02-08 Jason Merrill <jason@redhat.com>
+
+ * typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
+ if appropriate.
+
2020-02-08 Jakub Jelinek <jakub@redhat.com>
PR c++/93549
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 371b203..4892089 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -1929,11 +1929,15 @@ process_init_constructor (tree type, tree init, int nested, int flags,
TREE_SIDE_EFFECTS (init) = true;
}
else if (picflags & PICFLAG_NOT_ALL_CONSTANT)
- /* Make sure TREE_CONSTANT isn't set from build_constructor. */
- TREE_CONSTANT (init) = false;
+ {
+ /* Make sure TREE_CONSTANT isn't set from build_constructor. */
+ TREE_CONSTANT (init) = false;
+ TREE_SIDE_EFFECTS (init) = false;
+ }
else
{
TREE_CONSTANT (init) = 1;
+ TREE_SIDE_EFFECTS (init) = false;
if (!(picflags & PICFLAG_NOT_ALL_SIMPLE))
TREE_STATIC (init) = 1;
}