public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Harald Anlauf <anlauf@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r11-10274] Fortran: error recovery on invalid ARRAY argument to FINDLOC [PR106986]
Date: Mon, 26 Sep 2022 18:13:10 +0000 (GMT) [thread overview]
Message-ID: <20220926181310.EC0683858D37@sourceware.org> (raw)
https://gcc.gnu.org/g:50592ed4703d2e1ade2b197c58b72da0b91933cc
commit r11-10274-g50592ed4703d2e1ade2b197c58b72da0b91933cc
Author: Harald Anlauf <anlauf@gmx.de>
Date: Tue Sep 20 22:41:48 2022 +0200
Fortran: error recovery on invalid ARRAY argument to FINDLOC [PR106986]
gcc/fortran/ChangeLog:
PR fortran/106986
* simplify.c (gfc_simplify_findloc): Do not try to simplify
intrinsic FINDLOC when the ARRAY argument has a NULL shape.
gcc/testsuite/ChangeLog:
PR fortran/106986
* gfortran.dg/pr106986.f90: New test.
(cherry picked from commit 5976fbf9d5dd9542fcb82eebb2185886fd52d000)
Diff:
---
gcc/fortran/simplify.c | 1 +
gcc/testsuite/gfortran.dg/pr106986.f90 | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index e02c2e1cf3f..a1834e33081 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -5846,6 +5846,7 @@ gfc_simplify_findloc (gfc_expr *array, gfc_expr *value, gfc_expr *dim,
bool back_val = false;
if (!is_constant_array_expr (array)
+ || array->shape == NULL
|| !gfc_is_constant_expr (dim))
return NULL;
diff --git a/gcc/testsuite/gfortran.dg/pr106986.f90 b/gcc/testsuite/gfortran.dg/pr106986.f90
new file mode 100644
index 00000000000..a309b25d181
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr106986.f90
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/106986 - ICE in simplify_findloc_nodim
+! Contributed by G.Steinmetz
+
+program p
+ integer, parameter :: a(:) = [1] ! { dg-error "deferred shape" }
+ print *, findloc (a, 1)
+end
reply other threads:[~2022-09-26 18:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220926181310.EC0683858D37@sourceware.org \
--to=anlauf@gcc.gnu.org \
--cc=gcc-cvs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).