]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
typeck.c (java_array_type_length, [...]): Represent empty arrays by NULL index.
authorMatt Kraai <kraai@alumni.carnegiemellon.edu>
Fri, 7 Sep 2001 08:54:32 +0000 (08:54 +0000)
committerRichard Henderson <rth@gcc.gnu.org>
Fri, 7 Sep 2001 08:54:32 +0000 (01:54 -0700)
        * java/typeck.c (java_array_type_length, build_prim_array_type):
        Represent empty arrays by NULL index.

        * stor-layout.c (compute_record_mode): Check DECL_SIZE is set.

From-SVN: r45460

gcc/ChangeLog
gcc/java/ChangeLog
gcc/java/typeck.c
gcc/stor-layout.c

index dedc597e1045b7fe2d66701f1edc4468ce5ead03..42660490415960aaf30fef4c55f2ee99dea80157 100644 (file)
@@ -1,3 +1,7 @@
+2001-09-07  Matt Kraai  <kraai@alumni.carnegiemellon.edu>
+
+       * stor-layout.c (compute_record_mode): Check DECL_SIZE is set.
+
 2001-09-06  Ira Ruben  <ira@apple.com>
 
        Remove OP_IDENTIFIER.
index 0315ded4bffbc421e2c6b219e84875821a91d9f4..c50858777672109db1afe268f000a4c815d4e188 100644 (file)
@@ -1,3 +1,8 @@
+2001-09-07  Matt Kraai  <kraai@alumni.carnegiemellon.edu>
+
+       * typeck.c (java_array_type_length, build_prim_array_type):
+       Represent empty arrays by NULL index.
+
 2001-09-06  Anthony Green  <green@redhat.com>
 
        * class.c (O_BINARY): Define if necessary.
index b61a290c7ed756a71f752e92fc262cfd4c3dbf91..4f8a34e752e021d9322a79068c70c2c37dd39a25 100644 (file)
@@ -353,9 +353,12 @@ java_array_type_length (array_type)
   if (arfld != NULL_TREE)
     {
       tree index_type = TYPE_DOMAIN (TREE_TYPE (arfld));
-      tree high = TYPE_MAX_VALUE (index_type);
-      if (TREE_CODE (high) == INTEGER_CST)
-       return TREE_INT_CST_LOW (high) + 1;
+      if (index_type != NULL_TREE)
+       {
+         tree high = TYPE_MAX_VALUE (index_type);
+         if (TREE_CODE (high) == INTEGER_CST)
+           return TREE_INT_CST_LOW (high) + 1;
+       }
     }
   return -1;
 }
@@ -370,9 +373,15 @@ build_prim_array_type (element_type, length)
      tree element_type;
      HOST_WIDE_INT length;
 {
-  tree max_index = build_int_2 (length - 1, (0 == length ? -1 : 0));
-  TREE_TYPE (max_index) = sizetype;
-  return build_array_type (element_type, build_index_type (max_index));
+  tree index = NULL;
+
+  if (length != -1)
+    {
+      tree max_index = build_int_2 (length - 1, (0 == length ? -1 : 0));
+      TREE_TYPE (max_index) = sizetype;
+      index = build_index_type (max_index);
+    }
+  return build_array_type (element_type, index);
 }
 
 /* Return a Java array type with a given ELEMENT_TYPE and LENGTH.
index 3a4f998902fe8de812512969a29e627a4cbc1016..e145b97e5d6f14005bbf80f2bf6ab83af08b58f9 100644 (file)
@@ -1110,6 +1110,7 @@ compute_record_mode (type)
          || (TYPE_MODE (TREE_TYPE (field)) == BLKmode
              && ! TYPE_NO_FORCE_BLK (TREE_TYPE (field)))
          || ! host_integerp (bit_position (field), 1)
+         || DECL_SIZE (field) == 0
          || ! host_integerp (DECL_SIZE (field), 1))
        return;