aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMatt Kraai <kraai@alumni.carnegiemellon.edu>2001-09-07 08:54:32 +0000
committerRichard Henderson <rth@gcc.gnu.org>2001-09-07 01:54:32 -0700
commit6a9f67271e36408566367fee6cdff374b85550ed (patch)
tree1e788927b81a47a45083c0dbbb5b39a39a643941 /gcc
parentb5f20931962d4ef52f2ff80891a7feb74e6811be (diff)
downloadgcc-6a9f67271e36408566367fee6cdff374b85550ed.zip
gcc-6a9f67271e36408566367fee6cdff374b85550ed.tar.gz
gcc-6a9f67271e36408566367fee6cdff374b85550ed.tar.bz2
typeck.c (java_array_type_length, [...]): Represent empty arrays by NULL index.
* 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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/java/ChangeLog5
-rw-r--r--gcc/java/typeck.c21
-rw-r--r--gcc/stor-layout.c1
4 files changed, 25 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dedc597..4266049 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 0315ded..c508587 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -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.
diff --git a/gcc/java/typeck.c b/gcc/java/typeck.c
index b61a290..4f8a34e 100644
--- a/gcc/java/typeck.c
+++ b/gcc/java/typeck.c
@@ -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.
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 3a4f998..e145b97 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -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;