c-semantics.c (build_stmt): Remove test of specific tree codes for TREE_SIDE_EFFECTS...
authorIan Lance Taylor <ian@airs.com>
Mon, 25 Apr 2005 01:18:23 +0000 (01:18 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Mon, 25 Apr 2005 01:18:23 +0000 (01:18 +0000)
* c-semantics.c (build_stmt): Remove test of specific tree codes
for TREE_SIDE_EFFECTS handling.

From-SVN: r98693

gcc/ChangeLog
gcc/c-semantics.c

index c183d6fe8c4344fbcf203891281b75412b7e68a9..3a776bc68d6c79ebe3923f9e2c639bb8f5f01c0b 100644 (file)
@@ -1,3 +1,8 @@
+2005-04-24  Ian Lance Taylor  <ian@airs.com>
+
+       * c-semantics.c (build_stmt): Remove test of specific tree codes
+       for TREE_SIDE_EFFECTS handling.
+
 2005-04-24  Per Bothner  <per@bothner.com>
 
        * c-opts.c (finish_options):  Make the line-number of the <built-in>
index 567a440706b2a1738853bc6e45db442242803caf..fe81249117fcf2c9c7760d5a94a08b940be3eb3c 100644 (file)
@@ -149,19 +149,12 @@ build_stmt (enum tree_code code, ...)
   length = TREE_CODE_LENGTH (code);
   SET_EXPR_LOCATION (ret, input_location);
 
-  /* Most statements have implicit side effects all on their own, 
-     such as control transfer.  For those that do, we'll compute
-     the real value of TREE_SIDE_EFFECTS from its arguments.  */
-  switch (code)
-    {
-    case EXPR_STMT:
-      side_effects = false;
-      break;
-    default:
-      side_effects = true;
-      break;
-    }
+  /* TREE_SIDE_EFFECTS will already be set for statements with
+     implicit side effects.  Here we make sure it is set for other
+     expressions by checking whether the parameters have side
+     effects.  */
 
+  side_effects = false;
   for (i = 0; i < length; i++)
     {
       tree t = va_arg (p, tree);
@@ -170,7 +163,7 @@ build_stmt (enum tree_code code, ...)
       TREE_OPERAND (ret, i) = t;
     }
 
-  TREE_SIDE_EFFECTS (ret) = side_effects;
+  TREE_SIDE_EFFECTS (ret) |= side_effects;
 
   va_end (p);
   return ret;