public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/103392] New: [9/10/11/12 Regression] ICE in simplify_bound, at fortran/simplify.c:4273
@ 2021-11-23 19:00 gscfq@t-online.de
  2021-11-23 19:00 ` [Bug fortran/103392] " gscfq@t-online.de
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: gscfq@t-online.de @ 2021-11-23 19:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103392

            Bug ID: 103392
           Summary: [9/10/11/12 Regression] ICE in simplify_bound, at
                    fortran/simplify.c:4273
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Started with r6 :


$ cat z1.f90
program p
   integer, allocatable :: a(1:1)
   integer :: b(1) = lbound(a)
   integer :: c(1) = ubound(a)
end


$ gfortran-5 -c z1.f90
z1.f90:2:33:

    integer, allocatable :: a(1:1)
                                 1
Error: Allocatable array 'a' at (1) must have a deferred shape or assumed rank


$ gfortran-12-20211121 -c z1.f90
f951: internal compiler error: in simplify_bound, at fortran/simplify.c:4273
0x824e69 simplify_bound
        ../../gcc/fortran/simplify.c:4269
0x7ac9da do_simplify
        ../../gcc/fortran/intrinsic.c:4655
0x7b7a7a gfc_intrinsic_func_interface(gfc_expr*, int)
        ../../gcc/fortran/intrinsic.c:5034
0x80b71c resolve_unknown_f
        ../../gcc/fortran/resolve.c:2972
0x80b71c resolve_function
        ../../gcc/fortran/resolve.c:3329
0x80b71c gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.c:7166
0x79cac4 gfc_reduce_init_expr(gfc_expr*)
        ../../gcc/fortran/expr.c:3130
0x79f990 gfc_match_init_expr(gfc_expr**)
        ../../gcc/fortran/expr.c:3178
0x789f44 variable_decl
        ../../gcc/fortran/decl.c:3004
0x789f44 gfc_match_data_decl()
        ../../gcc/fortran/decl.c:6297
0x7f3df3 match_word
        ../../gcc/fortran/parse.c:67
0x7f3df3 decode_statement
        ../../gcc/fortran/parse.c:378
0x7f583a next_free
        ../../gcc/fortran/parse.c:1397
0x7f583a next_statement
        ../../gcc/fortran/parse.c:1629
0x7f6f5b parse_spec
        ../../gcc/fortran/parse.c:4168
0x7fa2bc parse_progunit
        ../../gcc/fortran/parse.c:6179
0x7fb5a1 gfc_parse_file()
        ../../gcc/fortran/parse.c:6724
0x848a6f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:216

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103392] [9/10/11/12 Regression] ICE in simplify_bound, at fortran/simplify.c:4273
  2021-11-23 19:00 [Bug fortran/103392] New: [9/10/11/12 Regression] ICE in simplify_bound, at fortran/simplify.c:4273 gscfq@t-online.de
@ 2021-11-23 19:00 ` gscfq@t-online.de
  2021-11-23 19:47 ` anlauf at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: gscfq@t-online.de @ 2021-11-23 19:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103392

G. Steinmetz <gscfq@t-online.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code

--- Comment #1 from G. Steinmetz <gscfq@t-online.de> ---


More variants :


$ cat z2.f90
program p
   integer, allocatable :: a(1:)
   integer :: b(1) = lbound(a)
   integer :: c(1) = ubound(a)
end


$ cat z3.f90
program p
   integer, allocatable :: a(1)
   integer :: b(1) = lbound(a)
   integer :: c(1) = ubound(a)
end


$ cat z4.f90
program p
   integer, allocatable :: a(1)
   integer :: b = lbound(a)
   integer :: c = ubound(a)
end


$ cat z5.f90
program p
   integer, allocatable :: a(1:)
   integer :: b, c
   b = lbound(a)
   c = ubound(a)
end

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103392] [9/10/11/12 Regression] ICE in simplify_bound, at fortran/simplify.c:4273
  2021-11-23 19:00 [Bug fortran/103392] New: [9/10/11/12 Regression] ICE in simplify_bound, at fortran/simplify.c:4273 gscfq@t-online.de
  2021-11-23 19:00 ` [Bug fortran/103392] " gscfq@t-online.de
@ 2021-11-23 19:47 ` anlauf at gcc dot gnu.org
  2021-11-23 20:47 ` anlauf at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-11-23 19:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103392

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-11-23
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #2 from anlauf at gcc dot gnu.org ---
Confirmed.

Tentative patch:

diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 6a6b3fbd037..477fd095b2d 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -4266,6 +4266,9 @@ simplify_bound (gfc_expr *array, gfc_expr *dim, gfc_expr
*kind, int upper)
             || (as->type == AS_ASSUMED_SHAPE && upper)))
     return NULL;

+  if (gfc_expr_attr (array).allocatable || gfc_expr_attr (array).pointer)
+    return NULL;
+
   gcc_assert (!as
              || (as->type != AS_DEFERRED
                  && array->expr_type == EXPR_VARIABLE

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103392] [9/10/11/12 Regression] ICE in simplify_bound, at fortran/simplify.c:4273
  2021-11-23 19:00 [Bug fortran/103392] New: [9/10/11/12 Regression] ICE in simplify_bound, at fortran/simplify.c:4273 gscfq@t-online.de
  2021-11-23 19:00 ` [Bug fortran/103392] " gscfq@t-online.de
  2021-11-23 19:47 ` anlauf at gcc dot gnu.org
@ 2021-11-23 20:47 ` anlauf at gcc dot gnu.org
  2021-11-23 21:02 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-11-23 20:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103392

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org
           Priority|P3                          |P4
             Status|NEW                         |ASSIGNED

--- Comment #3 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2021-November/057054.html

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103392] [9/10/11/12 Regression] ICE in simplify_bound, at fortran/simplify.c:4273
  2021-11-23 19:00 [Bug fortran/103392] New: [9/10/11/12 Regression] ICE in simplify_bound, at fortran/simplify.c:4273 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2021-11-23 20:47 ` anlauf at gcc dot gnu.org
@ 2021-11-23 21:02 ` cvs-commit at gcc dot gnu.org
  2021-11-24  8:41 ` [Bug fortran/103392] [9/10/11 " marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-23 21:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103392

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:16e95050f71e9fa408e9bd8ccd415b0e7adc66e5

commit r12-5480-g16e95050f71e9fa408e9bd8ccd415b0e7adc66e5
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Tue Nov 23 21:39:36 2021 +0100

    Fortran: do not attempt simplification of [LU]BOUND for pointer/allocatable

    gcc/fortran/ChangeLog:

            PR fortran/103392
            * simplify.c (simplify_bound): Do not try to simplify
            LBOUND/UBOUND for arrays with POINTER or ALLOCATABLE attribute.

    gcc/testsuite/ChangeLog:

            PR fortran/103392
            * gfortran.dg/bound_simplification_7.f90: New test.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103392] [9/10/11 Regression] ICE in simplify_bound, at fortran/simplify.c:4273
  2021-11-23 19:00 [Bug fortran/103392] New: [9/10/11/12 Regression] ICE in simplify_bound, at fortran/simplify.c:4273 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2021-11-23 21:02 ` cvs-commit at gcc dot gnu.org
@ 2021-11-24  8:41 ` marxin at gcc dot gnu.org
  2021-11-24  8:41 ` marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-24  8:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103392

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[9/10/11/12 Regression] ICE |[9/10/11 Regression] ICE in
                   |in simplify_bound, at       |simplify_bound, at
                   |fortran/simplify.c:4273     |fortran/simplify.c:4273
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed on master with r12-5480-g16e95050f71e9fa4 and it started with
r6-597-g22fa926f19ae0ebb.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103392] [9/10/11 Regression] ICE in simplify_bound, at fortran/simplify.c:4273
  2021-11-23 19:00 [Bug fortran/103392] New: [9/10/11/12 Regression] ICE in simplify_bound, at fortran/simplify.c:4273 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2021-11-24  8:41 ` [Bug fortran/103392] [9/10/11 " marxin at gcc dot gnu.org
@ 2021-11-24  8:41 ` marxin at gcc dot gnu.org
  2021-11-24  8:53 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-11-24  8:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103392

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
@Anlauf: Heh, you fixed faster than I made bisection :P

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103392] [9/10/11 Regression] ICE in simplify_bound, at fortran/simplify.c:4273
  2021-11-23 19:00 [Bug fortran/103392] New: [9/10/11/12 Regression] ICE in simplify_bound, at fortran/simplify.c:4273 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2021-11-24  8:41 ` marxin at gcc dot gnu.org
@ 2021-11-24  8:53 ` rguenth at gcc dot gnu.org
  2021-11-24 21:35 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-24  8:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103392

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.5

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103392] [9/10/11 Regression] ICE in simplify_bound, at fortran/simplify.c:4273
  2021-11-23 19:00 [Bug fortran/103392] New: [9/10/11/12 Regression] ICE in simplify_bound, at fortran/simplify.c:4273 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2021-11-24  8:53 ` rguenth at gcc dot gnu.org
@ 2021-11-24 21:35 ` cvs-commit at gcc dot gnu.org
  2021-11-26 20:45 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-24 21:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103392

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:56b3036c531929e0dae1103b9f5d20c82643415f

commit r11-9308-g56b3036c531929e0dae1103b9f5d20c82643415f
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Tue Nov 23 21:39:36 2021 +0100

    Fortran: do not attempt simplification of [LU]BOUND for pointer/allocatable

    gcc/fortran/ChangeLog:

            PR fortran/103392
            * simplify.c (simplify_bound): Do not try to simplify
            LBOUND/UBOUND for arrays with POINTER or ALLOCATABLE attribute.

    gcc/testsuite/ChangeLog:

            PR fortran/103392
            * gfortran.dg/bound_simplification_7.f90: New test.

    (cherry picked from commit 16e95050f71e9fa408e9bd8ccd415b0e7adc66e5)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103392] [9/10/11 Regression] ICE in simplify_bound, at fortran/simplify.c:4273
  2021-11-23 19:00 [Bug fortran/103392] New: [9/10/11/12 Regression] ICE in simplify_bound, at fortran/simplify.c:4273 gscfq@t-online.de
                   ` (7 preceding siblings ...)
  2021-11-24 21:35 ` cvs-commit at gcc dot gnu.org
@ 2021-11-26 20:45 ` cvs-commit at gcc dot gnu.org
  2021-11-26 20:50 ` cvs-commit at gcc dot gnu.org
  2021-11-26 20:50 ` anlauf at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-26 20:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103392

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:376b2c781d11f55644e92dfea91c3f214f20f4ac

commit r10-10311-g376b2c781d11f55644e92dfea91c3f214f20f4ac
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Tue Nov 23 21:39:36 2021 +0100

    Fortran: do not attempt simplification of [LU]BOUND for pointer/allocatable

    gcc/fortran/ChangeLog:

            PR fortran/103392
            * simplify.c (simplify_bound): Do not try to simplify
            LBOUND/UBOUND for arrays with POINTER or ALLOCATABLE attribute.

    gcc/testsuite/ChangeLog:

            PR fortran/103392
            * gfortran.dg/bound_simplification_7.f90: New test.

    (cherry picked from commit 16e95050f71e9fa408e9bd8ccd415b0e7adc66e5)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103392] [9/10/11 Regression] ICE in simplify_bound, at fortran/simplify.c:4273
  2021-11-23 19:00 [Bug fortran/103392] New: [9/10/11/12 Regression] ICE in simplify_bound, at fortran/simplify.c:4273 gscfq@t-online.de
                   ` (8 preceding siblings ...)
  2021-11-26 20:45 ` cvs-commit at gcc dot gnu.org
@ 2021-11-26 20:50 ` cvs-commit at gcc dot gnu.org
  2021-11-26 20:50 ` anlauf at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-26 20:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103392

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:dd1871c823e2ec9a500ac5ad3c87a117b934fa3b

commit r9-9846-gdd1871c823e2ec9a500ac5ad3c87a117b934fa3b
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Tue Nov 23 21:39:36 2021 +0100

    Fortran: do not attempt simplification of [LU]BOUND for pointer/allocatable

    gcc/fortran/ChangeLog:

            PR fortran/103392
            * simplify.c (simplify_bound): Do not try to simplify
            LBOUND/UBOUND for arrays with POINTER or ALLOCATABLE attribute.

    gcc/testsuite/ChangeLog:

            PR fortran/103392
            * gfortran.dg/bound_simplification_7.f90: New test.

    (cherry picked from commit 16e95050f71e9fa408e9bd8ccd415b0e7adc66e5)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug fortran/103392] [9/10/11 Regression] ICE in simplify_bound, at fortran/simplify.c:4273
  2021-11-23 19:00 [Bug fortran/103392] New: [9/10/11/12 Regression] ICE in simplify_bound, at fortran/simplify.c:4273 gscfq@t-online.de
                   ` (9 preceding siblings ...)
  2021-11-26 20:50 ` cvs-commit at gcc dot gnu.org
@ 2021-11-26 20:50 ` anlauf at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-11-26 20:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103392

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #10 from anlauf at gcc dot gnu.org ---
Fixed on all open branches down to gcc-9.  Closing.

Thanks for the report!

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-11-26 20:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-23 19:00 [Bug fortran/103392] New: [9/10/11/12 Regression] ICE in simplify_bound, at fortran/simplify.c:4273 gscfq@t-online.de
2021-11-23 19:00 ` [Bug fortran/103392] " gscfq@t-online.de
2021-11-23 19:47 ` anlauf at gcc dot gnu.org
2021-11-23 20:47 ` anlauf at gcc dot gnu.org
2021-11-23 21:02 ` cvs-commit at gcc dot gnu.org
2021-11-24  8:41 ` [Bug fortran/103392] [9/10/11 " marxin at gcc dot gnu.org
2021-11-24  8:41 ` marxin at gcc dot gnu.org
2021-11-24  8:53 ` rguenth at gcc dot gnu.org
2021-11-24 21:35 ` cvs-commit at gcc dot gnu.org
2021-11-26 20:45 ` cvs-commit at gcc dot gnu.org
2021-11-26 20:50 ` cvs-commit at gcc dot gnu.org
2021-11-26 20:50 ` anlauf at gcc dot gnu.org

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).