PR fortran/101565 - ICE in gfc_simplify_image_index, at fortran/simplify.c:8234
Commit Message
Dear all,
a trivial one: we need to check the type of the SUB argument
to the coarray IMAGE_INDEX intrinsic. It has to be an array
of type integer.
Patch by Steve Kargl.
Regtested on x86_64-pc-linux-gnu. OK for mainline?
Thanks,
Harald
Comments
Hello,
Le 29/11/2021 à 22:31, Harald Anlauf via Fortran a écrit :
> Dear all,
>
> a trivial one: we need to check the type of the SUB argument
> to the coarray IMAGE_INDEX intrinsic. It has to be an array
> of type integer.
>
> Patch by Steve Kargl.
>
I hope at some point he’ll finally come to a working git workflow.
> Regtested on x86_64-pc-linux-gnu. OK for mainline?
>
Sure.
Hi Mikael,
Am 30.11.21 um 12:25 schrieb Mikael Morin:
> Hello,
>
> Le 29/11/2021 à 22:31, Harald Anlauf via Fortran a écrit :
>> Dear all,
>>
>> a trivial one: we need to check the type of the SUB argument
>> to the coarray IMAGE_INDEX intrinsic. It has to be an array
>> of type integer.
>>
>> Patch by Steve Kargl.
>>
> I hope at some point he’ll finally come to a working git workflow.
Initially I had to rethink my workflow habits when switching from
svn to git. But after a steep learning curve I wouldn't want to
go back. One day Steve might see it same way.
>> Regtested on x86_64-pc-linux-gnu. OK for mainline?
>>
> Sure.
>
Thanks,
Harald
From 58140e3cf97aedc5c9f3b3e6519027334cdc3213 Mon Sep 17 00:00:00 2001
From: Harald Anlauf <anlauf@gmx.de>
Date: Mon, 29 Nov 2021 22:23:02 +0100
Subject: [PATCH] Fortran: check type of SUB argument to IMAGE_INDEX
gcc/fortran/ChangeLog:
PR fortran/101565
* check.c (gfc_check_image_index): Verify that SUB argument to
IMAGE_INDEX is of type integer.
gcc/testsuite/ChangeLog:
PR fortran/101565
* gfortran.dg/coarray_49.f90: New test.
---
gcc/fortran/check.c | 7 +++++++
gcc/testsuite/gfortran.dg/coarray_49.f90 | 9 +++++++++
2 files changed, 16 insertions(+)
create mode 100644 gcc/testsuite/gfortran.dg/coarray_49.f90
@@ -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);
new file mode 100644
@@ -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
--
2.26.2