public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/103504] New: ICE in get_sym_storage_size, at fortran/interface.c:2800
@ 2021-11-30 18:44 gscfq@t-online.de
  2021-11-30 20:48 ` [Bug fortran/103504] " anlauf at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: gscfq@t-online.de @ 2021-11-30 18:44 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103504
           Summary: ICE in get_sym_storage_size, at
                    fortran/interface.c:2800
           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 :


$ cat z1.f90
subroutine s(x)
   real :: x(abs(1.))
end
program p
   real :: y(1)
   call s(y)
end


$ cat z2.f90
program p
   real :: y(1)
   call s(y)
contains
   subroutine s(x)
      real :: x(abs(1.))
   end
end


$ gfortran-12-20211128 -c z1.f90
z1.f90:2:13:

    2 |    real :: x(abs(1.))
      |             1
Error: Expression at (1) must be of INTEGER type, found REAL
z1.f90:2:13:

    2 |    real :: x(abs(1.))
      |             1
Error: Expression at (1) must be of INTEGER type, found REAL
f951: internal compiler error: Segmentation fault
0xf0942f crash_signal
        ../../gcc/toplev.c:322
0x7e94f9 get_sym_storage_size
        ../../gcc/fortran/interface.c:2800
0x7e94f9 gfc_compare_actual_formal(gfc_actual_arglist**, gfc_formal_arglist*,
int, int, bool, locus*)
        ../../gcc/fortran/interface.c:3292
0x94dff6 check_externals_procedure
        ../../gcc/fortran/frontend-passes.c:5725
0x952ce9 gfc_code_walker(gfc_code**, int (*)(gfc_code**, int*, void*), int
(*)(gfc_expr**, int*, void*), void*)
        ../../gcc/fortran/frontend-passes.c:5333
0x95454b gfc_check_externals0
        ../../gcc/fortran/frontend-passes.c:5844
0x9553d4 gfc_check_externals(gfc_namespace*)
        ../../gcc/fortran/frontend-passes.c:5866
0x83d3c2 gfc_parse_file()
        ../../gcc/fortran/parse.c:6856
0x88b37f gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:216

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

* [Bug fortran/103504] ICE in get_sym_storage_size, at fortran/interface.c:2800
  2021-11-30 18:44 [Bug fortran/103504] New: ICE in get_sym_storage_size, at fortran/interface.c:2800 gscfq@t-online.de
@ 2021-11-30 20:48 ` anlauf at gcc dot gnu.org
  2022-07-24 20:02 ` 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-11-30 20:48 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #1 from anlauf at gcc dot gnu.org ---
Likely related to PR103505.  The spec for dummy x of subroutine s is foul.

  symtree: 'x'           || symbol: 'x'            
    type spec : (REAL 4)
    attributes: (VARIABLE  DIMENSION DUMMY)
    Array spec:(1 [0] AS_EXPLICIT 1 1.00000000 )

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

* [Bug fortran/103504] ICE in get_sym_storage_size, at fortran/interface.c:2800
  2021-11-30 18:44 [Bug fortran/103504] New: ICE in get_sym_storage_size, at fortran/interface.c:2800 gscfq@t-online.de
  2021-11-30 20:48 ` [Bug fortran/103504] " anlauf at gcc dot gnu.org
@ 2022-07-24 20:02 ` anlauf at gcc dot gnu.org
  2022-07-25 20:41 ` anlauf at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-07-24 20:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from anlauf at gcc dot gnu.org ---
The ICE is avoided by:

diff --git a/gcc/fortran/interface.cc b/gcc/fortran/interface.cc
index 7ed6e13711f..f8a1720ea7e 100644
--- a/gcc/fortran/interface.cc
+++ b/gcc/fortran/interface.cc
@@ -2809,7 +2809,9 @@ get_sym_storage_size (gfc_symbol *sym)
   for (i = 0; i < sym->as->rank; i++)
     {
       if (sym->as->upper[i]->expr_type != EXPR_CONSTANT
-         || sym->as->lower[i]->expr_type != EXPR_CONSTANT)
+         || sym->as->lower[i]->expr_type != EXPR_CONSTANT
+         || sym->as->upper[i]->ts.type != BT_INTEGER
+         || sym->as->lower[i]->ts.type != BT_INTEGER)
        return 0;

       elements *= mpz_get_si (sym->as->upper[i]->value.integer)

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

* [Bug fortran/103504] ICE in get_sym_storage_size, at fortran/interface.c:2800
  2021-11-30 18:44 [Bug fortran/103504] New: ICE in get_sym_storage_size, at fortran/interface.c:2800 gscfq@t-online.de
  2021-11-30 20:48 ` [Bug fortran/103504] " anlauf at gcc dot gnu.org
  2022-07-24 20:02 ` anlauf at gcc dot gnu.org
@ 2022-07-25 20:41 ` anlauf at gcc dot gnu.org
  2022-07-26 17:18 ` 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 @ 2022-07-25 20:41 UTC (permalink / raw)
  To: gcc-bugs

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

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/2022-July/058017.html

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

* [Bug fortran/103504] ICE in get_sym_storage_size, at fortran/interface.c:2800
  2021-11-30 18:44 [Bug fortran/103504] New: ICE in get_sym_storage_size, at fortran/interface.c:2800 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2022-07-25 20:41 ` anlauf at gcc dot gnu.org
@ 2022-07-26 17:18 ` cvs-commit at gcc dot gnu.org
  2022-07-26 18:45 ` 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 @ 2022-07-26 17:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:600956c81c784f4a0cc9d10f6e03e01847afd961

commit r13-1846-g600956c81c784f4a0cc9d10f6e03e01847afd961
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Jul 25 22:29:50 2022 +0200

    Fortran: error recovery from calculation of storage size of a symbol
[PR103504]

    gcc/fortran/ChangeLog:

            PR fortran/103504
            * interface.cc (get_sym_storage_size): Array bounds and character
            length can only be of integer type.

    gcc/testsuite/ChangeLog:

            PR fortran/103504
            * gfortran.dg/pr103504.f90: New test.

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

* [Bug fortran/103504] ICE in get_sym_storage_size, at fortran/interface.c:2800
  2021-11-30 18:44 [Bug fortran/103504] New: ICE in get_sym_storage_size, at fortran/interface.c:2800 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2022-07-26 17:18 ` cvs-commit at gcc dot gnu.org
@ 2022-07-26 18:45 ` cvs-commit at gcc dot gnu.org
  2022-07-26 18:47 ` 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 @ 2022-07-26 18:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

commit r12-8620-g2009850b2b7042a678c385cd72e6ceb40caac8cd
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Jul 25 22:29:50 2022 +0200

    Fortran: error recovery from calculation of storage size of a symbol
[PR103504]

    gcc/fortran/ChangeLog:

            PR fortran/103504
            * interface.cc (get_sym_storage_size): Array bounds and character
            length can only be of integer type.

    gcc/testsuite/ChangeLog:

            PR fortran/103504
            * gfortran.dg/pr103504.f90: New test.

    (cherry picked from commit 600956c81c784f4a0cc9d10f6e03e01847afd961)

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

* [Bug fortran/103504] ICE in get_sym_storage_size, at fortran/interface.c:2800
  2021-11-30 18:44 [Bug fortran/103504] New: ICE in get_sym_storage_size, at fortran/interface.c:2800 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2022-07-26 18:45 ` cvs-commit at gcc dot gnu.org
@ 2022-07-26 18:47 ` cvs-commit at gcc dot gnu.org
  2022-07-26 18:55 ` cvs-commit at gcc dot gnu.org
  2022-07-26 18:58 ` anlauf at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-26 18:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 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:2916e857c2941b57cbecf42ee8d5b9ab9d0c8b7d

commit r11-10176-g2916e857c2941b57cbecf42ee8d5b9ab9d0c8b7d
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Jul 25 22:29:50 2022 +0200

    Fortran: error recovery from calculation of storage size of a symbol
[PR103504]

    gcc/fortran/ChangeLog:

            PR fortran/103504
            * interface.c (get_sym_storage_size): Array bounds and character
            length can only be of integer type.

    gcc/testsuite/ChangeLog:

            PR fortran/103504
            * gfortran.dg/pr103504.f90: New test.

    (cherry picked from commit 600956c81c784f4a0cc9d10f6e03e01847afd961)

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

* [Bug fortran/103504] ICE in get_sym_storage_size, at fortran/interface.c:2800
  2021-11-30 18:44 [Bug fortran/103504] New: ICE in get_sym_storage_size, at fortran/interface.c:2800 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2022-07-26 18:47 ` cvs-commit at gcc dot gnu.org
@ 2022-07-26 18:55 ` cvs-commit at gcc dot gnu.org
  2022-07-26 18:58 ` anlauf at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-26 18:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

commit r10-10916-ga872c617293cf9f6dfae7ed889bbca34884f145c
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Jul 25 22:29:50 2022 +0200

    Fortran: error recovery from calculation of storage size of a symbol
[PR103504]

    gcc/fortran/ChangeLog:

            PR fortran/103504
            * interface.c (get_sym_storage_size): Array bounds and character
            length can only be of integer type.

    gcc/testsuite/ChangeLog:

            PR fortran/103504
            * gfortran.dg/pr103504.f90: New test.

    (cherry picked from commit 600956c81c784f4a0cc9d10f6e03e01847afd961)

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

* [Bug fortran/103504] ICE in get_sym_storage_size, at fortran/interface.c:2800
  2021-11-30 18:44 [Bug fortran/103504] New: ICE in get_sym_storage_size, at fortran/interface.c:2800 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2022-07-26 18:55 ` cvs-commit at gcc dot gnu.org
@ 2022-07-26 18:58 ` anlauf at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-07-26 18:58 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

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

Thanks for the report!

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

end of thread, other threads:[~2022-07-26 18:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 18:44 [Bug fortran/103504] New: ICE in get_sym_storage_size, at fortran/interface.c:2800 gscfq@t-online.de
2021-11-30 20:48 ` [Bug fortran/103504] " anlauf at gcc dot gnu.org
2022-07-24 20:02 ` anlauf at gcc dot gnu.org
2022-07-25 20:41 ` anlauf at gcc dot gnu.org
2022-07-26 17:18 ` cvs-commit at gcc dot gnu.org
2022-07-26 18:45 ` cvs-commit at gcc dot gnu.org
2022-07-26 18:47 ` cvs-commit at gcc dot gnu.org
2022-07-26 18:55 ` cvs-commit at gcc dot gnu.org
2022-07-26 18:58 ` 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).