OSDN Git Service

(make_node, case 'c'): For INTEGER_CST, use size of struct containing
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 27 Dec 1992 03:18:12 +0000 (03:18 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 27 Dec 1992 03:18:12 +0000 (03:18 +0000)
constant, just like for reals.  Also, clean up code to avoid confusing
fallthrough.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@2919 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/tree.c

index 98c06bd..3ce46f6 100644 (file)
@@ -844,13 +844,21 @@ make_node (code)
       kind = c_kind;
 #endif
       obstack = expression_obstack;
-      /* We can't use tree_code_length for this, since the number of words
-        is machine-dependent due to varying alignment of `double'.  */
-      if (code == REAL_CST)
-       {
-         length = sizeof (struct tree_real_cst);
-         break;
-       }
+
+      /* We can't use tree_code_length for INTEGER_CST, since the number of
+        words is machine-dependent due to varying length of HOST_WIDE_INT,
+        which might be wider than a pointer (e.g., long long).  Similarly
+        for REAL_CST, since the number of words is machine-dependent due
+        to varying size and alignment of `double'.  */
+
+      if (code == INTEGER_CST)
+       length = sizeof (struct tree_int_cst);
+      else if (code == REAL_CST)
+       length = sizeof (struct tree_real_cst);
+      else
+       length = sizeof (struct tree_common)
+         + tree_code_length[(int) code] * sizeof (char *);
+      break;
 
     case 'x':  /* something random, like an identifier.  */
 #ifdef GATHER_STATISTICS