public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/108421] New: ICE in get_expr_storage_size, at fortran/interface.cc:2862
@ 2023-01-16 17:48 gscfq@t-online.de
  2023-01-16 20:04 ` [Bug fortran/108421] " anlauf at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: gscfq@t-online.de @ 2023-01-16 17:48 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108421
           Summary: ICE in get_expr_storage_size, at
                    fortran/interface.cc:2862
           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: ---

Affects versions down to at least r5 :
(follow-up of pr107707)


$ cat z1.f90
program p
   character(real(3)) :: c
   call s(c)
end
subroutine s(x)
   character(*) :: x
end


$ gfortran-13-20230115 -c z1.f90
z1.f90:2:13:

    2 |    character(real(3)) :: c
      |             1
Error: Expression at (1) must be of INTEGER type, found REAL
f951: internal compiler error: Segmentation fault
0xf8734f crash_signal
        ../../gcc/toplev.cc:314
0x848e0d get_expr_storage_size
        ../../gcc/fortran/interface.cc:2862
0x848e0d gfc_compare_actual_formal(gfc_actual_arglist**, gfc_formal_arglist*,
int, int, bool, locus*)
        ../../gcc/fortran/interface.cc:3326
0x9b2746 check_externals_procedure
        ../../gcc/fortran/frontend-passes.cc:5742
0x9b7439 gfc_code_walker(gfc_code**, int (*)(gfc_code**, int*, void*), int
(*)(gfc_expr**, int*, void*), void*)
        ../../gcc/fortran/frontend-passes.cc:5352
0x9b8c9b gfc_check_externals0
        ../../gcc/fortran/frontend-passes.cc:5861
0x9b9c24 gfc_check_externals(gfc_namespace*)
        ../../gcc/fortran/frontend-passes.cc:5883
0x89e900 gfc_parse_file()
        ../../gcc/fortran/parse.cc:6942
0x8ed3af gfc_be_parse_file
        ../../gcc/fortran/f95-lang.cc:229

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

* [Bug fortran/108421] ICE in get_expr_storage_size, at fortran/interface.cc:2862
  2023-01-16 17:48 [Bug fortran/108421] New: ICE in get_expr_storage_size, at fortran/interface.cc:2862 gscfq@t-online.de
@ 2023-01-16 20:04 ` anlauf at gcc dot gnu.org
  2023-01-16 21:12 ` anlauf at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-01-16 20:04 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2023-01-16
                 CC|                            |anlauf at gcc dot gnu.org

--- Comment #1 from anlauf at gcc dot gnu.org ---
Confirmed.  A very old issue.

Patch:

diff --git a/gcc/fortran/interface.cc b/gcc/fortran/interface.cc
index c4f7faaf597..307082b048d 100644
--- a/gcc/fortran/interface.cc
+++ b/gcc/fortran/interface.cc
@@ -2858,6 +2858,7 @@ get_expr_storage_size (gfc_expr *e)
   if (e->ts.type == BT_CHARACTER)
     {
       if (e->ts.u.cl && e->ts.u.cl->length
+         && e->ts.u.cl->length->ts.type == BT_INTEGER
           && e->ts.u.cl->length->expr_type == EXPR_CONSTANT)
        strlen = mpz_get_si (e->ts.u.cl->length->value.integer);
       else if (e->expr_type == EXPR_CONSTANT

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

* [Bug fortran/108421] ICE in get_expr_storage_size, at fortran/interface.cc:2862
  2023-01-16 17:48 [Bug fortran/108421] New: ICE in get_expr_storage_size, at fortran/interface.cc:2862 gscfq@t-online.de
  2023-01-16 20:04 ` [Bug fortran/108421] " anlauf at gcc dot gnu.org
@ 2023-01-16 21:12 ` anlauf at gcc dot gnu.org
  2023-01-17 19:39 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-01-16 21:12 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #2 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2023-January/058773.html

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

* [Bug fortran/108421] ICE in get_expr_storage_size, at fortran/interface.cc:2862
  2023-01-16 17:48 [Bug fortran/108421] New: ICE in get_expr_storage_size, at fortran/interface.cc:2862 gscfq@t-online.de
  2023-01-16 20:04 ` [Bug fortran/108421] " anlauf at gcc dot gnu.org
  2023-01-16 21:12 ` anlauf at gcc dot gnu.org
@ 2023-01-17 19:39 ` cvs-commit at gcc dot gnu.org
  2023-01-17 19:41 ` anlauf at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-17 19:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:a75760374ee54768e5fd6a27080698bfbbd041ab

commit r13-5232-ga75760374ee54768e5fd6a27080698bfbbd041ab
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Jan 16 21:30:56 2023 +0100

    Fortran: fix ICE in get_expr_storage_size [PR108421]

    gcc/fortran/ChangeLog:

            PR fortran/108421
            * interface.cc (get_expr_storage_size): Check that we actually have
            an integer value before trying to extract it with mpz_get_si.

    gcc/testsuite/ChangeLog:

            PR fortran/108421
            * gfortran.dg/pr108421.f90: New test.

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

* [Bug fortran/108421] ICE in get_expr_storage_size, at fortran/interface.cc:2862
  2023-01-16 17:48 [Bug fortran/108421] New: ICE in get_expr_storage_size, at fortran/interface.cc:2862 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2023-01-17 19:39 ` cvs-commit at gcc dot gnu.org
@ 2023-01-17 19:41 ` anlauf at gcc dot gnu.org
  2023-01-28 21:45 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-01-17 19:41 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

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

--- Comment #4 from anlauf at gcc dot gnu.org ---
Fixed on mainline for gcc-13.  Closing.

Thanks for the report!

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

* [Bug fortran/108421] ICE in get_expr_storage_size, at fortran/interface.cc:2862
  2023-01-16 17:48 [Bug fortran/108421] New: ICE in get_expr_storage_size, at fortran/interface.cc:2862 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2023-01-17 19:41 ` anlauf 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
  6 siblings, 0 replies; 8+ 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=108421

--- 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:0e4c239ebde0a926832e3bcaae707eabf81927ff

commit r12-9078-g0e4c239ebde0a926832e3bcaae707eabf81927ff
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Jan 16 21:30:56 2023 +0100

    Fortran: fix ICE in get_expr_storage_size [PR108421]

    gcc/fortran/ChangeLog:

            PR fortran/108421
            * interface.cc (get_expr_storage_size): Check that we actually have
            an integer value before trying to extract it with mpz_get_si.

    gcc/testsuite/ChangeLog:

            PR fortran/108421
            * gfortran.dg/pr108421.f90: New test.

    (cherry picked from commit a75760374ee54768e5fd6a27080698bfbbd041ab)

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

* [Bug fortran/108421] ICE in get_expr_storage_size, at fortran/interface.cc:2862
  2023-01-16 17:48 [Bug fortran/108421] New: ICE in get_expr_storage_size, at fortran/interface.cc:2862 gscfq@t-online.de
                   ` (4 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
  6 siblings, 0 replies; 8+ 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=108421

--- 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:2235737a967c9eeabe7b02ffb014d8efef3276af

commit r11-10502-g2235737a967c9eeabe7b02ffb014d8efef3276af
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Jan 16 21:30:56 2023 +0100

    Fortran: fix ICE in get_expr_storage_size [PR108421]

    gcc/fortran/ChangeLog:

            PR fortran/108421
            * interface.c (get_expr_storage_size): Check that we actually have
            an integer value before trying to extract it with mpz_get_si.

    gcc/testsuite/ChangeLog:

            PR fortran/108421
            * gfortran.dg/pr108421.f90: New test.

    (cherry picked from commit a75760374ee54768e5fd6a27080698bfbbd041ab)

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

* [Bug fortran/108421] ICE in get_expr_storage_size, at fortran/interface.cc:2862
  2023-01-16 17:48 [Bug fortran/108421] New: ICE in get_expr_storage_size, at fortran/interface.cc:2862 gscfq@t-online.de
                   ` (5 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
  6 siblings, 0 replies; 8+ 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=108421

--- 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:068fce9743ec9f3181c189cb8d03a982ca30eb7e

commit r10-11194-g068fce9743ec9f3181c189cb8d03a982ca30eb7e
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon Jan 16 21:30:56 2023 +0100

    Fortran: fix ICE in get_expr_storage_size [PR108421]

    gcc/fortran/ChangeLog:

            PR fortran/108421
            * interface.c (get_expr_storage_size): Check that we actually have
            an integer value before trying to extract it with mpz_get_si.

    gcc/testsuite/ChangeLog:

            PR fortran/108421
            * gfortran.dg/pr108421.f90: New test.

    (cherry picked from commit a75760374ee54768e5fd6a27080698bfbbd041ab)

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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-16 17:48 [Bug fortran/108421] New: ICE in get_expr_storage_size, at fortran/interface.cc:2862 gscfq@t-online.de
2023-01-16 20:04 ` [Bug fortran/108421] " anlauf at gcc dot gnu.org
2023-01-16 21:12 ` anlauf at gcc dot gnu.org
2023-01-17 19:39 ` cvs-commit at gcc dot gnu.org
2023-01-17 19:41 ` anlauf 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).