Commit 6a9f6727 by Matt Kraai Committed by Richard Henderson

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
parent b5f20931
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> 2001-09-06 Ira Ruben <ira@apple.com>
Remove OP_IDENTIFIER. Remove OP_IDENTIFIER.
......
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> 2001-09-06 Anthony Green <green@redhat.com>
* class.c (O_BINARY): Define if necessary. * class.c (O_BINARY): Define if necessary.
......
...@@ -353,10 +353,13 @@ java_array_type_length (array_type) ...@@ -353,10 +353,13 @@ java_array_type_length (array_type)
if (arfld != NULL_TREE) if (arfld != NULL_TREE)
{ {
tree index_type = TYPE_DOMAIN (TREE_TYPE (arfld)); tree index_type = TYPE_DOMAIN (TREE_TYPE (arfld));
if (index_type != NULL_TREE)
{
tree high = TYPE_MAX_VALUE (index_type); tree high = TYPE_MAX_VALUE (index_type);
if (TREE_CODE (high) == INTEGER_CST) if (TREE_CODE (high) == INTEGER_CST)
return TREE_INT_CST_LOW (high) + 1; return TREE_INT_CST_LOW (high) + 1;
} }
}
return -1; return -1;
} }
...@@ -370,9 +373,15 @@ build_prim_array_type (element_type, length) ...@@ -370,9 +373,15 @@ build_prim_array_type (element_type, length)
tree element_type; tree element_type;
HOST_WIDE_INT length; HOST_WIDE_INT length;
{ {
tree index = NULL;
if (length != -1)
{
tree max_index = build_int_2 (length - 1, (0 == length ? -1 : 0)); tree max_index = build_int_2 (length - 1, (0 == length ? -1 : 0));
TREE_TYPE (max_index) = sizetype; TREE_TYPE (max_index) = sizetype;
return build_array_type (element_type, build_index_type (max_index)); 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. /* Return a Java array type with a given ELEMENT_TYPE and LENGTH.
......
...@@ -1110,6 +1110,7 @@ compute_record_mode (type) ...@@ -1110,6 +1110,7 @@ compute_record_mode (type)
|| (TYPE_MODE (TREE_TYPE (field)) == BLKmode || (TYPE_MODE (TREE_TYPE (field)) == BLKmode
&& ! TYPE_NO_FORCE_BLK (TREE_TYPE (field))) && ! TYPE_NO_FORCE_BLK (TREE_TYPE (field)))
|| ! host_integerp (bit_position (field), 1) || ! host_integerp (bit_position (field), 1)
|| DECL_SIZE (field) == 0
|| ! host_integerp (DECL_SIZE (field), 1)) || ! host_integerp (DECL_SIZE (field), 1))
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment