Message ID | trinity-52c2addb-d7e7-4d79-8ac0-ed2b268b6947-1638221463295@3c-app-gmx-bs36 |
---|---|
State | New |
Headers | show |
Series | PR fortran/101565 - ICE in gfc_simplify_image_index, at fortran/simplify.c:8234 | expand |
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 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