Bug 99817 - [10/11 Regression] ICE in create_function_arglist, at fortran/trans-decl.c:2838 (etc.)
Summary: [10/11 Regression] ICE in create_function_arglist, at fortran/trans-decl.c:28...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 11.0
: P4 normal
Target Milestone: 10.4
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2021-03-29 19:29 UTC by G. Steinmetz
Modified: 2021-04-12 11:04 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-03-29 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description G. Steinmetz 2021-03-29 19:29:06 UTC
Changed between 20210314 and 20210328 :


$ cat z1.f90
subroutine s1 (x)
   character(*) :: x(*)[*]
end


$ cat z2.f90
subroutine s2 (x)
   character(*), dimension(*), codimension[*] :: x
   integer :: i
   i = len(x)
end


$ gfortran-11-20210314 -c z1.f90 -fcoarray=lib
$ gfortran-11-20210314 -c z1.f90 -fcoarray=single
$ gfortran-11-20210328 -c z1.f90 -fcoarray=single
$
$ gfortran-11-20210328 -c z1.f90 -fcoarray=lib
z1.f90:1:13:

    1 | subroutine s1 (x)
      |             1
internal compiler error: Segmentation fault
0xc09d4f crash_signal
        ../../gcc/toplev.c:327
0x754ed9 create_function_arglist
        ../../gcc/fortran/trans-decl.c:2838
0x75a153 gfc_create_function_decl(gfc_namespace*, bool)
        ../../gcc/fortran/trans-decl.c:3089
0x7603b6 gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.c:6778
0x6e5de6 translate_all_program_units
        ../../gcc/fortran/parse.c:6351
0x6e5de6 gfc_parse_file()
        ../../gcc/fortran/parse.c:6620
0x7320ef gfc_be_parse_file
        ../../gcc/fortran/f95-lang.c:212
Comment 1 G. Steinmetz 2021-03-29 19:29:52 UTC
Related variants :


$ cat z3.f90
subroutine s3 (x, y)
   character(*), dimension(:) :: x[*]
   character(*) :: y
end


$ cat z4.f90
subroutine s4 (x, y, z)
   character(*), dimension(:) :: x[2, *]
   character(*), dimension(*) :: y
   character(*) :: z
end


$ gfortran-11-20210328 -c z3.f90 -fcoarray=lib
z3.f90:1:13:

    1 | subroutine s3 (x, y)
      |             1
internal compiler error: Segmentation fault
0xc09d4f crash_signal
        ../../gcc/toplev.c:327
0x754bd9 create_function_arglist
        ../../gcc/fortran/trans-decl.c:2625
#...


$ gfortran-11-20210328 -c z4.f90 -fcoarray=lib
z4.f90:1:13:

    1 | subroutine s4 (x, y, z)
      |             1
internal compiler error: in create_function_arglist, at fortran/trans-decl.c:2628
0x75539e create_function_arglist
        ../../gcc/fortran/trans-decl.c:2628
#...
Comment 2 Dominique d'Humieres 2021-03-29 20:12:49 UTC
Confirmed.
Comment 3 anlauf 2021-03-30 19:32:51 UTC
The ICE happens in

Program received signal SIGSEGV, Segmentation fault.
create_function_arglist (sym=<optimized out>)
    at ../../gcc-trunk/gcc/fortran/trans-decl.c:2838
2838              hidden_typelist = TREE_CHAIN (hidden_typelist);
(gdb) 

git blame points to:

commit 212f4988f37ccf788c8c72b1dc952980bc9be3b7
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Tue Mar 23 15:45:36 2021 +0100

    Fortran: Fix func decl mismatch [PR93660]

Adding Tobias.
Comment 4 Richard Biener 2021-04-08 12:02:21 UTC
GCC 10.3 is being released, retargeting bugs to GCC 10.4.
Comment 5 GCC Commits 2021-04-09 08:42:04 UTC
The master branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:

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

commit r11-8076-gd31f485dedc86773152d0384bc6ba5583b259a42
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Fri Apr 9 10:18:24 2021 +0200

    Fortran: Fix fndecl with -fcoarray=lib [PR99817]
    
    gcc/fortran/ChangeLog:
    
            PR fortran/99817
            * trans-types.c (gfc_get_function_type): Also generate hidden
            coarray argument for character arguments.
    
    gcc/testsuite/ChangeLog:
    
            PR fortran/99817
            * gfortran.dg/coarray/dummy_2.f90: New test.
Comment 6 GCC Commits 2021-04-12 11:02:02 UTC
The releases/gcc-10 branch has been updated by Tobias Burnus <burnus@gcc.gnu.org>:

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

commit r10-9697-ge976dc67ac5b0f6e9ea5e7e0e4f99c40e5abcd28
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Fri Apr 9 10:18:24 2021 +0200

    Fortran: Fix fndecl with -fcoarray=lib [PR99817]
    
    gcc/fortran/ChangeLog:
    
            PR fortran/99817
            * trans-types.c (gfc_get_function_type): Also generate hidden
            coarray argument for character arguments.
    
    gcc/testsuite/ChangeLog:
    
            PR fortran/99817
            * gfortran.dg/coarray/dummy_2.f90: New test.
    
    (cherry picked from commit d31f485dedc86773152d0384bc6ba5583b259a42)
Comment 7 Tobias Burnus 2021-04-12 11:04:13 UTC
FIXED (GCC 10+mainline/11) - thanks for the report.

Unfortunately, it (just) did miss the GCC 10.3 release.