https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120049
Bug ID: 120049
Summary: ICE when using IS_C_ASSOCIATED ()
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: jvdelisle at gcc dot gnu.org
Target Milestone: ---
I am getting an ICE from one of the example programs for gtk-fortran. I am
working to reduce the test case. At the point of the ICE both of the arguments
to gfc_check_c_associated in check.cc appear to have no basic type.
The example program fails when uncommenting the following code section:
! Changing the type of the GValue:
call g_value_unset(p_val)
p_val = g_value_init(p_val, G_TYPE_POINTER)
call g_value_set_pointer(p_val, c_loc(val))
p_val2 = g_value_get_pointer(p_val)
! FIXME: the following lines compiles with Intel ifx but causes an internal
! error with GFortran 14.2.0:
! if (.not.c_associated(p_val2, c_loc(val))) then
! print '(A)', "Problem!"
! errors = errors + 1
! end if
The program can be found here:
https://github.com/vmagnin/gtk-fortran/blob/gtk4/examples/tests_gtk_sup.f90
$ gfc14 -c -I/usr/local/include/gtk-4-fortran ./original/tests_gtk_sup.f90
f951: internal compiler error: gfc_typename(): Undefined type
0x48e80e diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
../../gcc14/gcc/diagnostic.h:986
0x48e80e gfc_report_diagnostic
../../gcc14/gcc/fortran/error.cc:949
0x48e80e gfc_internal_error(char const*, ...)
../../gcc14/gcc/fortran/error.cc:1573
0x4ccc9e gfc_typename(gfc_typespec*, bool)
../../gcc14/gcc/fortran/misc.cc:212
0x4625ca gfc_check_c_associated(gfc_expr*, gfc_expr*)
../../gcc14/gcc/fortran/check.cc:5378
0x4a62c6 check_specific
../../gcc14/gcc/fortran/intrinsic.cc:4815
0x4b0775 gfc_intrinsic_func_interface(gfc_expr*, int)
../../gcc14/gcc/fortran/intrinsic.cc:5056
0x518368 resolve_unknown_f
../../gcc14/gcc/fortran/resolve.cc:3046
0x518368 resolve_function
../../gcc14/gcc/fortran/resolve.cc:3403
0x518755 gfc_resolve_expr(gfc_expr*)
../../gcc14/gcc/fortran/resolve.cc:7542
0x5185c4 gfc_resolve_expr(gfc_expr*)
../../gcc14/gcc/fortran/resolve.cc:7509
0x5185c4 resolve_operator
../../gcc14/gcc/fortran/resolve.cc:4185
0x5185c4 gfc_resolve_expr(gfc_expr*)
../../gcc14/gcc/fortran/resolve.cc:7535
0x526f29 gfc_resolve_expr(gfc_expr*)
../../gcc14/gcc/fortran/resolve.cc:7509
0x526f29 gfc_resolve_blocks(gfc_code*, gfc_namespace*)
../../gcc14/gcc/fortran/resolve.cc:11334
0x522e46 gfc_resolve_code(gfc_code*, gfc_namespace*)
../../gcc14/gcc/fortran/resolve.cc:12670
0x526d8b resolve_codes
../../gcc14/gcc/fortran/resolve.cc:18481
0x526cae resolve_codes
../../gcc14/gcc/fortran/resolve.cc:18462
0x526e52 gfc_resolve(gfc_namespace*)
../../gcc14/gcc/fortran/resolve.cc:18516
0x503d47 gfc_parse_file()
../../gcc14/gcc/fortran/parse.cc:7240
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.