aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-04-22 08:34:41 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-04-22 08:34:41 +0000
commit92375a2020b1f32bf7be92025493cebd9b3b4400 (patch)
tree3b644ac3468bdfc3f3d146ccfd9417222f96a056 /gcc/fortran/resolve.c
parentc334c130bd67d51f03327e14a05ca4ba6b38be20 (diff)
downloadgcc-92375a2020b1f32bf7be92025493cebd9b3b4400.zip
gcc-92375a2020b1f32bf7be92025493cebd9b3b4400.tar.gz
gcc-92375a2020b1f32bf7be92025493cebd9b3b4400.tar.bz2
re PR fortran/43829 (Scalarization of reductions)
2010-04-22 Richard Guenther <rguenther@suse.de> PR fortran/43829 * resolve.c (gfc_resolve_index): Wrap around ... (gfc_resolve_index_1): ... this. Add parameter to allow any integer kind index type. (resolve_array_ref): Allow any integer kind for the start index of an array ref. * gfortran.dg/vector_subscript_6.f90: New testcase. * gfortran.dg/assign_10.f90: Adjust. From-SVN: r158632
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index b13edf9..aeccffb 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -3978,8 +3978,9 @@ compare_spec_to_ref (gfc_array_ref *ar)
/* Resolve one part of an array index. */
-gfc_try
-gfc_resolve_index (gfc_expr *index, int check_scalar)
+static gfc_try
+gfc_resolve_index_1 (gfc_expr *index, int check_scalar,
+ int force_index_integer_kind)
{
gfc_typespec ts;
@@ -4007,7 +4008,8 @@ gfc_resolve_index (gfc_expr *index, int check_scalar)
&index->where) == FAILURE)
return FAILURE;
- if (index->ts.kind != gfc_index_integer_kind
+ if ((index->ts.kind != gfc_index_integer_kind
+ && force_index_integer_kind)
|| index->ts.type != BT_INTEGER)
{
gfc_clear_ts (&ts);
@@ -4020,6 +4022,14 @@ gfc_resolve_index (gfc_expr *index, int check_scalar)
return SUCCESS;
}
+/* Resolve one part of an array index. */
+
+gfc_try
+gfc_resolve_index (gfc_expr *index, int check_scalar)
+{
+ return gfc_resolve_index_1 (index, check_scalar, 1);
+}
+
/* Resolve a dim argument to an intrinsic function. */
gfc_try
@@ -4144,7 +4154,10 @@ resolve_array_ref (gfc_array_ref *ar)
{
check_scalar = ar->dimen_type[i] == DIMEN_RANGE;
- if (gfc_resolve_index (ar->start[i], check_scalar) == FAILURE)
+ /* Do not force gfc_index_integer_kind for the start. We can
+ do fine with any integer kind. This avoids temporary arrays
+ created for indexing with a vector. */
+ if (gfc_resolve_index_1 (ar->start[i], check_scalar, 0) == FAILURE)
return FAILURE;
if (gfc_resolve_index (ar->end[i], check_scalar) == FAILURE)
return FAILURE;