* [PATCH] PR fortran/101565 - ICE in gfc_simplify_image_index, at fortran/simplify.c:8234
@ 2021-11-29 21:31 Harald Anlauf
2021-11-30 11:25 ` Mikael Morin
0 siblings, 1 reply; 4+ messages in thread
From: Harald Anlauf @ 2021-11-29 21:31 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 243 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fortran-check-type-of-SUB-argument-to-IMAGE_INDEX.patch --]
[-- Type: text/x-patch, Size: 1743 bytes --]
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
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 3e65f3d8b1f..ee3a51ee253 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 00000000000..370e3fd5847
--- /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
--
2.26.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PR fortran/101565 - ICE in gfc_simplify_image_index, at fortran/simplify.c:8234
2021-11-29 21:31 [PATCH] PR fortran/101565 - ICE in gfc_simplify_image_index, at fortran/simplify.c:8234 Harald Anlauf
@ 2021-11-30 11:25 ` Mikael Morin
2021-11-30 19:47 ` Harald Anlauf
0 siblings, 1 reply; 4+ messages in thread
From: Mikael Morin @ 2021-11-30 11:25 UTC (permalink / raw)
To: Harald Anlauf, fortran, gcc-patches
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PR fortran/101565 - ICE in gfc_simplify_image_index, at fortran/simplify.c:8234
2021-11-30 11:25 ` Mikael Morin
@ 2021-11-30 19:47 ` Harald Anlauf
2021-11-30 19:47 ` Harald Anlauf
0 siblings, 1 reply; 4+ messages in thread
From: Harald Anlauf @ 2021-11-30 19:47 UTC (permalink / raw)
To: Mikael Morin, fortran, gcc-patches
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] PR fortran/101565 - ICE in gfc_simplify_image_index, at fortran/simplify.c:8234
2021-11-30 19:47 ` Harald Anlauf
@ 2021-11-30 19:47 ` Harald Anlauf
0 siblings, 0 replies; 4+ messages in thread
From: Harald Anlauf @ 2021-11-30 19:47 UTC (permalink / raw)
To: gcc-patches; +Cc: fortran
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-11-30 19:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-29 21:31 [PATCH] PR fortran/101565 - ICE in gfc_simplify_image_index, at fortran/simplify.c:8234 Harald Anlauf
2021-11-30 11:25 ` Mikael Morin
2021-11-30 19:47 ` Harald Anlauf
2021-11-30 19:47 ` Harald Anlauf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).