summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-17 20:05:07 +0000
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2005-05-17 20:05:07 +0000
commitfe094ec072f6752572d98fb012f6354bfba336bb (patch)
tree1617c4b6661e4fbf4472e78eac60fa8dafd855f6
parentb9845e76ea57a7d1dd2fcef8d4ca953b33ca676a (diff)
downloadgcc-fe094ec072f6752572d98fb012f6354bfba336bb.tar.gz
* trans-types.c (gfc_array_range_type): New variable.
(gfc_init_types): Initialize gfc_array_range_type. (gfc_get_array_type_bounds): Use gfc_array_range_type. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99854 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans-types.c11
2 files changed, 14 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index c83763a505f..6e0a73b5d59 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2005-05-17 Zdenek Dvorak <dvorakz@suse.cz>
+
+ * trans-types.c (gfc_array_range_type): New variable.
+ (gfc_init_types): Initialize gfc_array_range_type.
+ (gfc_get_array_type_bounds): Use gfc_array_range_type.
+
2005-05-17 Jakub Jelinek <jakub@redhat.com>
PR fortran/15080
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index 44f19f486cc..a70784cbf3c 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -50,6 +50,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
static tree gfc_get_derived_type (gfc_symbol * derived);
tree gfc_array_index_type;
+tree gfc_array_range_type;
tree pvoid_type_node;
tree ppvoid_type_node;
tree pchar_type_node;
@@ -528,6 +529,12 @@ gfc_init_types (void)
pchar_type_node = build_pointer_type (gfc_character1_type_node);
gfc_array_index_type = gfc_get_int_type (gfc_index_integer_kind);
+ /* We cannot use gfc_index_zero_node in definition of gfc_array_range_type,
+ since this function is called before gfc_init_constants. */
+ gfc_array_range_type
+ = build_range_type (gfc_array_index_type,
+ build_int_cst (gfc_array_index_type, 0),
+ NULL_TREE);
/* The maximum array element size that can be handled is determined
by the number of bits available to store this field in the array
@@ -1182,9 +1189,7 @@ gfc_get_array_type_bounds (tree etype, int dimen, tree * lbound,
/* We define data as an unknown size array. Much better than doing
pointer arithmetic. */
arraytype =
- build_array_type (etype,
- build_range_type (gfc_array_index_type,
- gfc_index_zero_node, NULL_TREE));
+ build_array_type (etype, gfc_array_range_type);
arraytype = build_pointer_type (arraytype);
GFC_TYPE_ARRAY_DATAPTR_TYPE (fat_type) = arraytype;