public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/103588] New: ICE: Simplification error in gfc_ref_dimen_size, at fortran/array.c:2407
@ 2021-12-06 20:21 gscfq@t-online.de
  2021-12-06 20:53 ` [Bug fortran/103588] " anlauf at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: gscfq@t-online.de @ 2021-12-06 20:21 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103588
           Summary: ICE: Simplification error in gfc_ref_dimen_size, at
                    fortran/array.c:2407
           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: ---

Affects versions down to at least r5 :
(z1/z2 derived from a valid z0.f90)


$ cat z1.f90
program p
   integer, parameter :: a(:) = [1, 2]
   integer :: b(2) = a(::a(1))
end


$ cat z2.f90
program p
   integer, parameter :: a(:) = [1, 2]
   integer :: b(2) = a(1:2:a(1))
end


$ cat z0.f90
program p
   integer, parameter :: a(*) = [1, 2]
   integer :: b(2) = a(::a(1))
   print *, b
end


$ gfortran-12-20211205 -c z1.f90
f951: internal compiler error: Simplification error
0x799179 gfc_report_diagnostic
        ../../gcc/fortran/error.c:874
0x79ace7 gfc_internal_error(char const*, ...)
        ../../gcc/fortran/error.c:1494
0x768be0 gfc_ref_dimen_size(gfc_array_ref*, int, __mpz_struct (*) [1],
__mpz_struct (*) [1])
        ../../gcc/fortran/array.c:2407
0x80a6bf expression_shape
        ../../gcc/fortran/resolve.c:5501
0x80a6bf gfc_expression_rank(gfc_expr*)
        ../../gcc/fortran/resolve.c:5575
0x80c76b resolve_variable
        ../../gcc/fortran/resolve.c:6004
0x80c76b gfc_resolve_expr(gfc_expr*)
        ../../gcc/fortran/resolve.c:7168
0x79f054 gfc_reduce_init_expr(gfc_expr*)
        ../../gcc/fortran/expr.c:3155
0x7a1fc0 gfc_match_init_expr(gfc_expr**)
        ../../gcc/fortran/expr.c:3203
0x78c3d4 variable_decl
        ../../gcc/fortran/decl.c:3004
0x78c3d4 gfc_match_data_decl()
        ../../gcc/fortran/decl.c:6297
0x7f6343 match_word
        ../../gcc/fortran/parse.c:67
0x7f6343 decode_statement
        ../../gcc/fortran/parse.c:378
0x7f7d8a next_free
        ../../gcc/fortran/parse.c:1397
0x7f7d8a next_statement
        ../../gcc/fortran/parse.c:1629
0x7f931b parse_spec
        ../../gcc/fortran/parse.c:4168
0x7fc46c parse_progunit
        ../../gcc/fortran/parse.c:6192
0x7fdb31 gfc_parse_file()
        ../../gcc/fortran/parse.c:6737
0x84afaf gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:216

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

* [Bug fortran/103588] ICE: Simplification error in gfc_ref_dimen_size, at fortran/array.c:2407
  2021-12-06 20:21 [Bug fortran/103588] New: ICE: Simplification error in gfc_ref_dimen_size, at fortran/array.c:2407 gscfq@t-online.de
@ 2021-12-06 20:53 ` anlauf at gcc dot gnu.org
  2021-12-06 21:03 ` anlauf at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-12-06 20:53 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

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

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

* [Bug fortran/103588] ICE: Simplification error in gfc_ref_dimen_size, at fortran/array.c:2407
  2021-12-06 20:21 [Bug fortran/103588] New: ICE: Simplification error in gfc_ref_dimen_size, at fortran/array.c:2407 gscfq@t-online.de
  2021-12-06 20:53 ` [Bug fortran/103588] " anlauf at gcc dot gnu.org
@ 2021-12-06 21:03 ` anlauf at gcc dot gnu.org
  2021-12-06 22:40 ` anlauf at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-12-06 21:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from anlauf at gcc dot gnu.org ---
Untested patch:

diff --git a/gcc/fortran/array.c b/gcc/fortran/array.c
index 5762c8d92d4..5f9ed17f919 100644
--- a/gcc/fortran/array.c
+++ b/gcc/fortran/array.c
@@ -2403,11 +2403,9 @@ gfc_ref_dimen_size (gfc_array_ref *ar, int dimen, mpz_t
*result, mpz_t *end)
        {
          stride_expr = gfc_copy_expr(ar->stride[dimen]); 

-         if(!gfc_simplify_expr(stride_expr, 1))
-           gfc_internal_error("Simplification error");
-
-         if (stride_expr->expr_type != EXPR_CONSTANT
-             || mpz_cmp_ui (stride_expr->value.integer, 0) == 0)
+         if (!gfc_simplify_expr (stride_expr, 1)
+            || stride_expr->expr_type != EXPR_CONSTANT
+            || mpz_cmp_ui (stride_expr->value.integer, 0) == 0)
            {
              mpz_clear (stride);
              return false;

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

* [Bug fortran/103588] ICE: Simplification error in gfc_ref_dimen_size, at fortran/array.c:2407
  2021-12-06 20:21 [Bug fortran/103588] New: ICE: Simplification error in gfc_ref_dimen_size, at fortran/array.c:2407 gscfq@t-online.de
  2021-12-06 20:53 ` [Bug fortran/103588] " anlauf at gcc dot gnu.org
  2021-12-06 21:03 ` anlauf at gcc dot gnu.org
@ 2021-12-06 22:40 ` anlauf at gcc dot gnu.org
  2021-12-07 17:47 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-12-06 22:40 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

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

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

* [Bug fortran/103588] ICE: Simplification error in gfc_ref_dimen_size, at fortran/array.c:2407
  2021-12-06 20:21 [Bug fortran/103588] New: ICE: Simplification error in gfc_ref_dimen_size, at fortran/array.c:2407 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2021-12-06 22:40 ` anlauf at gcc dot gnu.org
@ 2021-12-07 17:47 ` cvs-commit at gcc dot gnu.org
  2021-12-11 21:14 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-07 17:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:652c28736209f10bac1aa7ecb31f9056b518dacf

commit r12-5826-g652c28736209f10bac1aa7ecb31f9056b518dacf
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Tue Dec 7 18:46:52 2021 +0100

    Fortran: catch failed simplification of bad stride expression

    gcc/fortran/ChangeLog:

            PR fortran/103588
            * array.c (gfc_ref_dimen_size): Do not generate internal error on
            failed simplification of stride expression; just return failure.

    gcc/testsuite/ChangeLog:

            PR fortran/103588
            * gfortran.dg/pr103588.f90: New test.

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

* [Bug fortran/103588] ICE: Simplification error in gfc_ref_dimen_size, at fortran/array.c:2407
  2021-12-06 20:21 [Bug fortran/103588] New: ICE: Simplification error in gfc_ref_dimen_size, at fortran/array.c:2407 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2021-12-07 17:47 ` cvs-commit at gcc dot gnu.org
@ 2021-12-11 21:14 ` cvs-commit at gcc dot gnu.org
  2021-12-19 20:29 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-11 21:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 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:b1bc9dba5c720b67d19df4d94634bb89ad5ade23

commit r11-9376-gb1bc9dba5c720b67d19df4d94634bb89ad5ade23
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Tue Dec 7 18:46:52 2021 +0100

    Fortran: catch failed simplification of bad stride expression

    gcc/fortran/ChangeLog:

            PR fortran/103588
            * array.c (gfc_ref_dimen_size): Do not generate internal error on
            failed simplification of stride expression; just return failure.

    gcc/testsuite/ChangeLog:

            PR fortran/103588
            * gfortran.dg/pr103588.f90: New test.

    (cherry picked from commit 652c28736209f10bac1aa7ecb31f9056b518dacf)

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

* [Bug fortran/103588] ICE: Simplification error in gfc_ref_dimen_size, at fortran/array.c:2407
  2021-12-06 20:21 [Bug fortran/103588] New: ICE: Simplification error in gfc_ref_dimen_size, at fortran/array.c:2407 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2021-12-11 21:14 ` cvs-commit at gcc dot gnu.org
@ 2021-12-19 20:29 ` cvs-commit at gcc dot gnu.org
  2021-12-19 20:51 ` cvs-commit at gcc dot gnu.org
  2021-12-19 20:53 ` anlauf at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-19 20:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 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:650ac4b25121e48a64a021b0d21738ea08be3511

commit r10-10351-g650ac4b25121e48a64a021b0d21738ea08be3511
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Tue Dec 7 18:46:52 2021 +0100

    Fortran: catch failed simplification of bad stride expression

    gcc/fortran/ChangeLog:

            PR fortran/103588
            * array.c (gfc_ref_dimen_size): Do not generate internal error on
            failed simplification of stride expression; just return failure.

    gcc/testsuite/ChangeLog:

            PR fortran/103588
            * gfortran.dg/pr103588.f90: New test.

    (cherry picked from commit 652c28736209f10bac1aa7ecb31f9056b518dacf)

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

* [Bug fortran/103588] ICE: Simplification error in gfc_ref_dimen_size, at fortran/array.c:2407
  2021-12-06 20:21 [Bug fortran/103588] New: ICE: Simplification error in gfc_ref_dimen_size, at fortran/array.c:2407 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2021-12-19 20:29 ` cvs-commit at gcc dot gnu.org
@ 2021-12-19 20:51 ` cvs-commit at gcc dot gnu.org
  2021-12-19 20:53 ` anlauf at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-19 20:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 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:c38611aabf4022323b7c44d0dcb3f6b076836de0

commit r9-9878-gc38611aabf4022323b7c44d0dcb3f6b076836de0
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Tue Dec 7 18:46:52 2021 +0100

    Fortran: catch failed simplification of bad stride expression

    gcc/fortran/ChangeLog:

            PR fortran/103588
            * array.c (gfc_ref_dimen_size): Do not generate internal error on
            failed simplification of stride expression; just return failure.

    gcc/testsuite/ChangeLog:

            PR fortran/103588
            * gfortran.dg/pr103588.f90: New test.

    (cherry picked from commit 652c28736209f10bac1aa7ecb31f9056b518dacf)

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

* [Bug fortran/103588] ICE: Simplification error in gfc_ref_dimen_size, at fortran/array.c:2407
  2021-12-06 20:21 [Bug fortran/103588] New: ICE: Simplification error in gfc_ref_dimen_size, at fortran/array.c:2407 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2021-12-19 20:51 ` cvs-commit at gcc dot gnu.org
@ 2021-12-19 20:53 ` anlauf at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-12-19 20:53 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.5
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #8 from anlauf at gcc dot gnu.org ---
Fixed on all open branches.

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

end of thread, other threads:[~2021-12-19 20:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-06 20:21 [Bug fortran/103588] New: ICE: Simplification error in gfc_ref_dimen_size, at fortran/array.c:2407 gscfq@t-online.de
2021-12-06 20:53 ` [Bug fortran/103588] " anlauf at gcc dot gnu.org
2021-12-06 21:03 ` anlauf at gcc dot gnu.org
2021-12-06 22:40 ` anlauf at gcc dot gnu.org
2021-12-07 17:47 ` cvs-commit at gcc dot gnu.org
2021-12-11 21:14 ` cvs-commit at gcc dot gnu.org
2021-12-19 20:29 ` cvs-commit at gcc dot gnu.org
2021-12-19 20:51 ` cvs-commit at gcc dot gnu.org
2021-12-19 20:53 ` 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).