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

            Bug ID: 121472
           Summary: ICE in gimplify_expr
           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 causes an ICE in gimplify_expr with the latest gfortran:

module m

  type :: r
  end type r

  type :: ip
     type(r) :: r_
   contains
     final :: ipd
  end type ip

  interface ip
     module procedure ipc
  end interface ip

contains

  function ipc() result(s)
    type(ip) :: s
    s%r_=r()
    return
  end function ipc

  subroutine ipd(s)
    type(ip), intent(inout) :: s
    return
  end subroutine ipd

end module m

program tmp
  use :: m
  type(ip) :: p
  p=ip()
end program tmp


> 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 20250804 (experimental) (GCC) 

> gfortran source/tmp1.F90
source/tmp1.F90:34:8:

   34 |   p=ip()
      |        ^
internal compiler error: in gimplify_expr, at gimplify.cc:20810
0x230e35b internal_error(char const*, ...)
        ../../gcc/diagnostic-global-context.cc:534
0x8285d7 fancy_abort(char const*, int, char const*)
        ../../gcc/diagnostics/context.cc:1640
0x7e45ac gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc/gimplify.cc:20810
0xcc71fc gimplify_stmt(tree_node**, gimple**)
        ../../gcc/gimplify.cc:8572
0xcdac5c gimplify_modify_expr
        ../../gcc/gimplify.cc:7314
0xcc352d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc/gimplify.cc:19893
0xcc71fc gimplify_stmt(tree_node**, gimple**)
        ../../gcc/gimplify.cc:8572
0xcc554b gimplify_statement_list
        ../../gcc/gimplify.cc:2292
0xcc554b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc/gimplify.cc:20344
0xcc71fc gimplify_stmt(tree_node**, gimple**)
        ../../gcc/gimplify.cc:8572
0xcc78e6 gimplify_bind_expr
        ../../gcc/gimplify.cc:1687
0xcc533c gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc/gimplify.cc:20094
0xcc71fc gimplify_stmt(tree_node**, gimple**)
        ../../gcc/gimplify.cc:8572
0xcc78e6 gimplify_bind_expr
        ../../gcc/gimplify.cc:1687
0xcc533c gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc/gimplify.cc:20094
0xcc71fc gimplify_stmt(tree_node**, gimple**)
        ../../gcc/gimplify.cc:8572
0xcc8f93 gimplify_body(tree_node*, bool)
        ../../gcc/gimplify.cc:21200
0xcc93b2 gimplify_function_tree(tree_node*)
        ../../gcc/gimplify.cc:21409
0xad111f cgraph_node::analyze()
        ../../gcc/cgraphunit.cc:689
0xad3a4c analyze_functions
        ../../gcc/cgraphunit.cc:1265
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