tree.c (make_node): Don't set TREE_TYPE on 's' class nodes.
authorJason Merrill <jason@redhat.com>
Wed, 18 Dec 2002 06:36:51 +0000 (01:36 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 18 Dec 2002 06:36:51 +0000 (01:36 -0500)
        * tree.c (make_node): Don't set TREE_TYPE on 's' class nodes.
        (build1): Always set TREE_SIDE_EFFECTS on 's' class nodes.

From-SVN: r60237

gcc/ChangeLog
gcc/tree.c

index d6c9dd79b27def5a469733b2cda30eb3ae801175..dca13eff81a4744a2783b3db8e5bceaab022f755 100644 (file)
@@ -1,5 +1,8 @@
 2002-12-17  Jason Merrill  <jason@redhat.com>
 
+       * tree.c (make_node): Don't set TREE_TYPE on 's' class nodes.
+       (build1): Always set TREE_SIDE_EFFECTS on 's' class nodes.
+
         * gcc.c (do_spec_1) ['W']: End any pending argument from the braces.
 
        * calls.c (expand_call): Don't try to be clever about expanding
index 1bfb66bf6d208eacdcbbfdc882de9669be57a720..736e38d399726ef8f2de5145063285f7a7da8b3b 100644 (file)
@@ -297,7 +297,6 @@ make_node (code)
     {
     case 's':
       TREE_SIDE_EFFECTS (t) = 1;
-      TREE_TYPE (t) = void_type_node;
       break;
 
     case 'd':
@@ -2269,17 +2268,28 @@ build1 (code, type, node)
      tree type;
      tree node;
 {
-  int length;
+  int length = sizeof (struct tree_exp);
 #ifdef GATHER_STATISTICS
   tree_node_kind kind;
 #endif
   tree t;
 
 #ifdef GATHER_STATISTICS
-  if (TREE_CODE_CLASS (code) == 'r')
-    kind = r_kind;
-  else
-    kind = e_kind;
+  switch (TREE_CODE_CLASS (code))
+    {
+    case 's':  /* an expression with side effects */
+      kind = s_kind;
+      break;
+    case 'r':  /* a reference */
+      kind = r_kind;
+      break;
+    default:
+      kind = e_kind;
+      break;
+    }
+
+  tree_node_counts[(int) kind]++;
+  tree_node_sizes[(int) kind] += length;
 #endif
 
 #ifdef ENABLE_CHECKING
@@ -2289,17 +2299,10 @@ build1 (code, type, node)
     abort ();
 #endif /* ENABLE_CHECKING */
 
-  length = sizeof (struct tree_exp);
-
   t = ggc_alloc_tree (length);
 
   memset ((PTR) t, 0, sizeof (struct tree_common));
 
-#ifdef GATHER_STATISTICS
-  tree_node_counts[(int) kind]++;
-  tree_node_sizes[(int) kind] += length;
-#endif
-
   TREE_SET_CODE (t, code);
 
   TREE_TYPE (t) = type;
@@ -2311,7 +2314,11 @@ build1 (code, type, node)
       TREE_READONLY (t) = TREE_READONLY (node);
     }
 
-  switch (code)
+  if (TREE_CODE_CLASS (code) == 's')
+    {
+      TREE_SIDE_EFFECTS (t) = 1;
+    }
+  else switch (code)
     {
     case INIT_EXPR:
     case MODIFY_EXPR: