public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-10506] Fortran: ICE in transformational_result [PR108529]
@ 2023-02-04 15:43 Harald Anlauf
  0 siblings, 0 replies; only message in thread
From: Harald Anlauf @ 2023-02-04 15:43 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:60032329cde87a7505b7784e1dcfb09574ee2e90

commit r11-10506-g60032329cde87a7505b7784e1dcfb09574ee2e90
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Tue Jan 24 21:39:43 2023 +0100

    Fortran: ICE in transformational_result [PR108529]
    
    gcc/fortran/ChangeLog:
    
            PR fortran/108529
            * simplify.c (simplify_transformation): Do not try to simplify
            transformational intrinsic when the ARRAY argument has a NULL shape.
    
    gcc/testsuite/ChangeLog:
    
            PR fortran/108529
            * gfortran.dg/pr108529.f90: New test.
    
    (cherry picked from commit 6c96382eed96a9285611f2e3e2e59557094172b8)

Diff:
---
 gcc/fortran/simplify.c                 | 1 +
 gcc/testsuite/gfortran.dg/pr108529.f90 | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index f13a8e57c83..8508f529c32 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -708,6 +708,7 @@ simplify_transformation (gfc_expr *array, gfc_expr *dim, gfc_expr *mask,
   size_zero = gfc_is_size_zero_array (array);
 
   if (!(is_constant_array_expr (array) || size_zero)
+      || array->shape == NULL
       || !gfc_is_constant_expr (dim))
     return NULL;
 
diff --git a/gcc/testsuite/gfortran.dg/pr108529.f90 b/gcc/testsuite/gfortran.dg/pr108529.f90
new file mode 100644
index 00000000000..34c9691fae1
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr108529.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! PR fortran/108529 - ICE in transformational_result
+! Contributed by G.Steinmetz
+
+program p
+  integer, parameter :: a(*,*) = reshape([1, 2, 3, 4], [2, 2])
+  logical, parameter :: b(2,*) = a > 2     ! { dg-error "Assumed size" }
+  logical, parameter :: c(*)   = all(b, 1) ! { dg-error "Bad shape" }
+end

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-02-04 15:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-04 15:43 [gcc r11-10506] Fortran: ICE in transformational_result [PR108529] 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).