aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-01-08 21:21:29 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-01-08 21:21:29 +0000
commit416a8af4dae6f8d204e168fd3137cc74238860a0 (patch)
tree50e2acad7a23791020b573a08cf21a892c8f51e2 /gcc
parent4d86971803c8cac4ce7c4f55ce189c5710fb11a5 (diff)
downloadgcc-416a8af4dae6f8d204e168fd3137cc74238860a0.zip
gcc-416a8af4dae6f8d204e168fd3137cc74238860a0.tar.gz
gcc-416a8af4dae6f8d204e168fd3137cc74238860a0.tar.bz2
re PR fortran/34706 (FE should reuse array temporaries, reduce temporaties and tell ME the array-size type)
2008-01-08 Richard Guenther <rguenther@suse.de> PR fortran/34706 PR tree-optimization/34683 * trans-types.c (gfc_get_array_type_bounds): Use an array type with known size for accesses if that is known. From-SVN: r131404
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/trans-types.c15
2 files changed, 17 insertions, 5 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 40c98af..e96f612 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2008-01-08 Richard Guenther <rguenther@suse.de>
+
+ PR fortran/34706
+ PR tree-optimization/34683
+ * trans-types.c (gfc_get_array_type_bounds): Use an array type
+ with known size for accesses if that is known.
+
2008-01-08 Paul Thomas <pault@gcc.gnu.org>
PR fortran/34476
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index 2d10dda..67eaf04 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -1436,7 +1436,7 @@ gfc_get_array_type_bounds (tree etype, int dimen, tree * lbound,
enum gfc_array_kind akind)
{
char name[8 + GFC_RANK_DIGITS + GFC_MAX_SYMBOL_LEN];
- tree fat_type, base_type, arraytype, lower, upper, stride, tmp;
+ tree fat_type, base_type, arraytype, lower, upper, stride, tmp, rtype;
const char *typename;
int n;
@@ -1511,10 +1511,15 @@ gfc_get_array_type_bounds (tree etype, int dimen, tree * lbound,
/* TODO: known offsets for descriptors. */
GFC_TYPE_ARRAY_OFFSET (fat_type) = NULL_TREE;
- /* We define data as an unknown size array. Much better than doing
- pointer arithmetic. */
- arraytype =
- build_array_type (etype, gfc_array_range_type);
+ /* We define data as an array with the correct size if possible.
+ Much better than doing pointer arithmetic. */
+ if (stride)
+ rtype = build_range_type (gfc_array_index_type, gfc_index_zero_node,
+ int_const_binop (MINUS_EXPR, stride,
+ integer_one_node, 0));
+ else
+ rtype = gfc_array_range_type;
+ arraytype = build_array_type (etype, rtype);
arraytype = build_pointer_type (arraytype);
GFC_TYPE_ARRAY_DATAPTR_TYPE (fat_type) = arraytype;