aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/check.c7
-rw-r--r--gcc/testsuite/gfortran.dg/coarray_49.f909
2 files changed, 16 insertions, 0 deletions
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 3e65f3d..ee3a51e 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -5955,6 +5955,13 @@ gfc_check_image_index (gfc_expr *coarray, gfc_expr *sub)
return false;
}
+ if (sub->ts.type != BT_INTEGER)
+ {
+ gfc_error ("Type of %s argument of IMAGE_INDEX at %L shall be INTEGER",
+ gfc_current_intrinsic_arg[1]->name, &sub->where);
+ return false;
+ }
+
if (gfc_array_size (sub, &nelems))
{
int corank = gfc_get_corank (coarray);
diff --git a/gcc/testsuite/gfortran.dg/coarray_49.f90 b/gcc/testsuite/gfortran.dg/coarray_49.f90
new file mode 100644
index 0000000..370e3fd
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/coarray_49.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=lib" }
+! PR fortran/101565 - ICE in gfc_simplify_image_index
+! Contributed by G. Steinmetz
+
+program p
+ integer :: x[*]
+ print *, image_index (x, [1.0]) ! { dg-error "shall be INTEGER" }
+end