c++: Fix TREE_SIDE_EFFECTS after digest_init.
authorJason Merrill <jason@redhat.com>
Fri, 7 Feb 2020 21:10:18 +0000 (16:10 -0500)
committerJason Merrill <jason@redhat.com>
Sat, 8 Feb 2020 16:14:58 +0000 (11:14 -0500)
* typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
if appropriate.

gcc/cp/ChangeLog
gcc/cp/typeck2.c

index 9205b200cd6e38c02bd2dc818ce75d6c31289af1..a0542b2a5b8798eb934b7337ccea22c27d35f149 100644 (file)
@@ -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
index 371b203c29bd6d208db92794e772179c9569db2f..48920894b3baa07161c3d52a51f3104b98928af6 100644 (file)
@@ -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;
     }