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

            Bug ID: 120302
           Summary: ICE in gfc_trans_call
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: abensonca at gcc dot gnu.org
  Target Milestone: ---

The following code (which must be in two separate files for the problem to
occur) causes an ICE with the current trunk (and as far back as 11.2.0 which is
the earliest version I have access to right now):

$ cat ivs.F90
module ivs
  type :: vs
   contains
     final :: dvs
  end type vs
contains
  elemental subroutine dvs (s)
    type(vs), intent(inout) :: s
    return
  end subroutine dvs
end module ivs

$ cat bmn.F90
module rf
contains
  function ed()
    use :: ivs, only : vs
    type(vs) :: ed
  end function ed
end module rf
module bb
  use :: rf
end module bb

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/carnegie/nobackup/users/abenson/upstream/libexec/gcc/x86_64-pc-linux-gnu/16.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure
--prefix=/carnegie/nobackup/users/abenson/upstream --disable-multilib
--enable-checking=release --enable-host-shared --with-pic
--enable-languages=c,c++,fortran,jit,lto
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.0 20250515 (experimental) (GCC) 

$ gfortran -c ivs.F90 
$ gfortran -c bmn.F90 
bmn.F90:10:13:

   10 | end module bb
      |             1
internal compiler error: in gfc_trans_call, at fortran/trans-stmt.cc:400
0x22e906b internal_error(char const*, ...)
        ../../gcc/diagnostic-global-context.cc:517
0x8147b3 fancy_abort(char const*, int, char const*)
        ../../gcc/diagnostic.cc:1815
0x7c980e gfc_trans_call(gfc_code*, bool, tree_node*, tree_node*, bool)
        ../../gcc/fortran/trans-stmt.cc:400
0x9611fe trans_code
        ../../gcc/fortran/trans.cc:2414
0x9f9eeb gfc_trans_simple_do
        ../../gcc/fortran/trans-stmt.cc:2710
0x9f9eeb gfc_trans_do(gfc_code*, tree_node*)
        ../../gcc/fortran/trans-stmt.cc:2842
0x96114c trans_code
        ../../gcc/fortran/trans.cc:2446
0x9faa08 gfc_trans_integer_select
        ../../gcc/fortran/trans-stmt.cc:3399
0x9faa08 gfc_trans_select(gfc_code*)
        ../../gcc/fortran/trans-stmt.cc:3893
0x961117 trans_code
        ../../gcc/fortran/trans.cc:2458
0x993d2f gfc_generate_function_code(gfc_namespace*)
        ../../gcc/fortran/trans-decl.cc:8060
0x9643c1 gfc_generate_module_code(gfc_namespace*)
        ../../gcc/fortran/trans.cc:2773
0x8f669b translate_all_program_units
        ../../gcc/fortran/parse.cc:7472
0x8f669b gfc_parse_file()
        ../../gcc/fortran/parse.cc:7805
0x95c14a gfc_be_parse_file
        ../../gcc/fortran/f95-lang.cc:247
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to