public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/108501] New: [13 Regression] ICE in get_expr_storage_size, at fortran/interface.cc:2941
@ 2023-01-23 17:47 gscfq@t-online.de
  2023-01-23 19:43 ` [Bug fortran/108501] " anlauf at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: gscfq@t-online.de @ 2023-01-23 17:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108501
           Summary: [13 Regression] ICE in get_expr_storage_size, at
                    fortran/interface.cc:2941
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Started between 20221218 and 20230108 :


$ cat z1.f90
program p
   real, parameter :: n = 2
   real :: a(1,(n),2)
   call s(a(:,:,1))
end
subroutine s(x)
   real :: x(2)
end


$ gfortran-13-20230122 -c z1.f90
z1.f90:3:15:

    3 |    real :: a(1,(n),2)
      |               1
Error: Expression at (1) must be of INTEGER type, found REAL
z1.f90:3:21:

    3 |    real :: a(1,(n),2)
      |                     1
Error: The module or main program array 'a' at (1) must have constant shape
f951: internal compiler error: Segmentation fault
0xf8a79f crash_signal
        ../../gcc/toplev.cc:314
0x848fd9 get_expr_storage_size
        ../../gcc/fortran/interface.cc:2941
0x848fd9 gfc_compare_actual_formal(gfc_actual_arglist**, gfc_formal_arglist*,
int, int, bool, locus*)
        ../../gcc/fortran/interface.cc:3327
0x9b3136 check_externals_procedure
        ../../gcc/fortran/frontend-passes.cc:5742
0x9b7e29 gfc_code_walker(gfc_code**, int (*)(gfc_code**, int*, void*), int
(*)(gfc_expr**, int*, void*), void*)
        ../../gcc/fortran/frontend-passes.cc:5352
0x9b968b gfc_check_externals0
        ../../gcc/fortran/frontend-passes.cc:5861
0x9ba614 gfc_check_externals(gfc_namespace*)
        ../../gcc/fortran/frontend-passes.cc:5883
0x89f2c0 gfc_parse_file()
        ../../gcc/fortran/parse.cc:6942
0x8edd9f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.cc:229

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

* [Bug fortran/108501] [13 Regression] ICE in get_expr_storage_size, at fortran/interface.cc:2941
  2023-01-23 17:47 [Bug fortran/108501] New: [13 Regression] ICE in get_expr_storage_size, at fortran/interface.cc:2941 gscfq@t-online.de
@ 2023-01-23 19:43 ` anlauf at gcc dot gnu.org
  2023-01-23 19:44 ` anlauf at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-01-23 19:43 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-01-23
           Keywords|ice-on-invalid-code         |ice-on-valid-code,
                   |                            |rejects-valid
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #1 from anlauf at gcc dot gnu.org ---
First, I think the code is actually valid, adjusting keywords.

Furthermore, there are two issues here, an underlying one, namely that
we reject the following:

program p
  real, parameter :: n = 2
  real :: a(1,(n),2)
end

pr108501.f90:3:14:

    3 |   real :: a(1,(n),2)
      |              1
Error: Expression at (1) must be of INTEGER type, found REAL
pr108501.f90:3:20:

    3 |   real :: a(1,(n),2)
      |                    1
Error: The module or main program array 'a' at (1) must have constant shape

This is already present in gcc-7, so although it is a nasty bug, it's not
a regression.

The other issue is likely exposed by this misbehavior, leading to an ICE
when checking the argument of the call in get_expr_storage_size.
This issue is also present in all versions down to at least gcc-7,
so arguably not really a regression.

I have a patch for the latter.

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

* [Bug fortran/108501] [13 Regression] ICE in get_expr_storage_size, at fortran/interface.cc:2941
  2023-01-23 17:47 [Bug fortran/108501] New: [13 Regression] ICE in get_expr_storage_size, at fortran/interface.cc:2941 gscfq@t-online.de
  2023-01-23 19:43 ` [Bug fortran/108501] " anlauf at gcc dot gnu.org
@ 2023-01-23 19:44 ` anlauf at gcc dot gnu.org
  2023-01-23 19:48 ` anlauf at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-01-23 19:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from anlauf at gcc dot gnu.org ---
Created attachment 54330
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54330&action=edit
Patch for the ICE in get_expr_storage_size

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

* [Bug fortran/108501] [13 Regression] ICE in get_expr_storage_size, at fortran/interface.cc:2941
  2023-01-23 17:47 [Bug fortran/108501] New: [13 Regression] ICE in get_expr_storage_size, at fortran/interface.cc:2941 gscfq@t-online.de
  2023-01-23 19:43 ` [Bug fortran/108501] " anlauf at gcc dot gnu.org
  2023-01-23 19:44 ` anlauf at gcc dot gnu.org
@ 2023-01-23 19:48 ` anlauf at gcc dot gnu.org
  2023-01-23 20:35 ` anlauf at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-01-23 19:48 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ice-on-valid-code,          |ice-on-invalid-code
                   |rejects-valid               |

--- Comment #3 from anlauf at gcc dot gnu.org ---
(In reply to anlauf from comment #1)
> First, I think the code is actually valid, adjusting keywords.

Oops, I cannot read, and Intel accepted the code when forgetting to
enfore standard conformance checking.

Putting a brown bag over my head.  Fixing keywords again...

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

* [Bug fortran/108501] [13 Regression] ICE in get_expr_storage_size, at fortran/interface.cc:2941
  2023-01-23 17:47 [Bug fortran/108501] New: [13 Regression] ICE in get_expr_storage_size, at fortran/interface.cc:2941 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2023-01-23 19:48 ` anlauf at gcc dot gnu.org
@ 2023-01-23 20:35 ` anlauf at gcc dot gnu.org
  2023-01-23 21:08 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-01-23 20:35 UTC (permalink / raw)
  To: gcc-bugs

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

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 #4 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2023-January/058818.html

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

* [Bug fortran/108501] [13 Regression] ICE in get_expr_storage_size, at fortran/interface.cc:2941
  2023-01-23 17:47 [Bug fortran/108501] New: [13 Regression] ICE in get_expr_storage_size, at fortran/interface.cc:2941 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2023-01-23 20:35 ` anlauf at gcc dot gnu.org
@ 2023-01-23 21:08 ` cvs-commit at gcc dot gnu.org
  2023-01-24  9:07 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-23 21:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

commit r13-5312-g771d793df1622a476e1cf8d05f0a6aee350fa56b
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Jan 23 21:19:03 2023 +0100

    Fortran: avoid ICE on invalid array subscript triplets [PR108501]

    gcc/fortran/ChangeLog:

            PR fortran/108501
            * interface.cc (get_expr_storage_size): Check array subscript
triplets
            that we actually have integer values before trying to extract with
            mpz_get_si.

    gcc/testsuite/ChangeLog:

            PR fortran/108501
            * gfortran.dg/pr108501.f90: New test.

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

* [Bug fortran/108501] [13 Regression] ICE in get_expr_storage_size, at fortran/interface.cc:2941
  2023-01-23 17:47 [Bug fortran/108501] New: [13 Regression] ICE in get_expr_storage_size, at fortran/interface.cc:2941 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2023-01-23 21:08 ` cvs-commit at gcc dot gnu.org
@ 2023-01-24  9:07 ` rguenth at gcc dot gnu.org
  2023-01-28 21:45 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-24  9:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed I assume.

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

* [Bug fortran/108501] [13 Regression] ICE in get_expr_storage_size, at fortran/interface.cc:2941
  2023-01-23 17:47 [Bug fortran/108501] New: [13 Regression] ICE in get_expr_storage_size, at fortran/interface.cc:2941 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2023-01-24  9:07 ` rguenth at gcc dot gnu.org
@ 2023-01-28 21:45 ` cvs-commit at gcc dot gnu.org
  2023-02-04 15:43 ` cvs-commit at gcc dot gnu.org
  2023-02-05 18:55 ` cvs-commit at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-28 21:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r12-9076-gdaa4c49a4773f274b7a784cedd7b0e0b3c59523b
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Jan 23 21:19:03 2023 +0100

    Fortran: avoid ICE on invalid array subscript triplets [PR108501]

    gcc/fortran/ChangeLog:

            PR fortran/108501
            * interface.cc (get_expr_storage_size): Check array subscript
triplets
            that we actually have integer values before trying to extract with
            mpz_get_si.

    gcc/testsuite/ChangeLog:

            PR fortran/108501
            * gfortran.dg/pr108501.f90: New test.

    (cherry picked from commit 771d793df1622a476e1cf8d05f0a6aee350fa56b)

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

* [Bug fortran/108501] [13 Regression] ICE in get_expr_storage_size, at fortran/interface.cc:2941
  2023-01-23 17:47 [Bug fortran/108501] New: [13 Regression] ICE in get_expr_storage_size, at fortran/interface.cc:2941 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2023-01-28 21:45 ` cvs-commit at gcc dot gnu.org
@ 2023-02-04 15:43 ` cvs-commit at gcc dot gnu.org
  2023-02-05 18:55 ` cvs-commit at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-04 15:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 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:76a6f8470c8c786b271cb0d897de891fe0d4043f

commit r11-10504-g76a6f8470c8c786b271cb0d897de891fe0d4043f
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Jan 23 21:19:03 2023 +0100

    Fortran: avoid ICE on invalid array subscript triplets [PR108501]

    gcc/fortran/ChangeLog:

            PR fortran/108501
            * interface.c (get_expr_storage_size): Check array subscript
triplets
            that we actually have integer values before trying to extract with
            mpz_get_si.

    gcc/testsuite/ChangeLog:

            PR fortran/108501
            * gfortran.dg/pr108501.f90: New test.

    (cherry picked from commit 771d793df1622a476e1cf8d05f0a6aee350fa56b)

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

* [Bug fortran/108501] [13 Regression] ICE in get_expr_storage_size, at fortran/interface.cc:2941
  2023-01-23 17:47 [Bug fortran/108501] New: [13 Regression] ICE in get_expr_storage_size, at fortran/interface.cc:2941 gscfq@t-online.de
                   ` (7 preceding siblings ...)
  2023-02-04 15:43 ` cvs-commit at gcc dot gnu.org
@ 2023-02-05 18:55 ` cvs-commit at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-02-05 18:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 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:d4bb7751af090736fb4a3bd7278d7094f35e02e4

commit r10-11196-gd4bb7751af090736fb4a3bd7278d7094f35e02e4
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Jan 23 21:19:03 2023 +0100

    Fortran: avoid ICE on invalid array subscript triplets [PR108501]

    gcc/fortran/ChangeLog:

            PR fortran/108501
            * interface.c (get_expr_storage_size): Check array subscript
triplets
            that we actually have integer values before trying to extract with
            mpz_get_si.

    gcc/testsuite/ChangeLog:

            PR fortran/108501
            * gfortran.dg/pr108501.f90: New test.

    (cherry picked from commit 771d793df1622a476e1cf8d05f0a6aee350fa56b)

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

end of thread, other threads:[~2023-02-05 18:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-23 17:47 [Bug fortran/108501] New: [13 Regression] ICE in get_expr_storage_size, at fortran/interface.cc:2941 gscfq@t-online.de
2023-01-23 19:43 ` [Bug fortran/108501] " anlauf at gcc dot gnu.org
2023-01-23 19:44 ` anlauf at gcc dot gnu.org
2023-01-23 19:48 ` anlauf at gcc dot gnu.org
2023-01-23 20:35 ` anlauf at gcc dot gnu.org
2023-01-23 21:08 ` cvs-commit at gcc dot gnu.org
2023-01-24  9:07 ` rguenth at gcc dot gnu.org
2023-01-28 21:45 ` cvs-commit at gcc dot gnu.org
2023-02-04 15:43 ` cvs-commit at gcc dot gnu.org
2023-02-05 18:55 ` cvs-commit 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).