[Bug fortran/104351] ICE in gfc_generate_initializer, at fortran/expr.cc:5140
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104351 anlauf at gcc dot gnu.org changed: What|Removed |Added Target Milestone|--- |14.0 Resolution|--- |FIXED Status|ASSIGNED|RESOLVED --- Comment #5 from anlauf at gcc dot gnu.org --- Fixed in gcc-14.
[Bug fortran/104351] ICE in gfc_generate_initializer, at fortran/expr.cc:5140
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104351 --- Comment #4 from CVS Commits --- The master branch has been updated by Harald Anlauf : https://gcc.gnu.org/g:d78fef5371759849944966dec65d9e987efba509 commit r14-4632-gd78fef5371759849944966dec65d9e987efba509 Author: Harald Anlauf Date: Wed Oct 11 21:29:35 2023 +0200 Fortran: name conflict between internal procedure and derived type [PR104351] gcc/fortran/ChangeLog: PR fortran/104351 * decl.cc (get_proc_name): Extend name conflict detection between internal procedure and previous declaration also to derived type. gcc/testsuite/ChangeLog: PR fortran/104351 * gfortran.dg/derived_function_interface_1.f90: Adjust pattern. * gfortran.dg/pr104351.f90: New test.
[Bug fortran/104351] ICE in gfc_generate_initializer, at fortran/expr.cc:5140
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104351 anlauf at gcc dot gnu.org changed: What|Removed |Added Assignee|unassigned at gcc dot gnu.org |anlauf at gcc dot gnu.org Status|NEW |ASSIGNED --- Comment #3 from anlauf at gcc dot gnu.org --- Submitted: https://gcc.gnu.org/pipermail/fortran/2023-October/059812.html
[Bug fortran/104351] ICE in gfc_generate_initializer, at fortran/expr.cc:5140
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104351 anlauf at gcc dot gnu.org changed: What|Removed |Added Keywords||accepts-invalid CC||anlauf at gcc dot gnu.org Last reconfirmed||2023-10-10 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #2 from anlauf at gcc dot gnu.org --- The following untested, semi-obvious patch fixes the ICE: diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc index 4a3c5b86de0..892e3788b9d 100644 --- a/gcc/fortran/decl.cc +++ b/gcc/fortran/decl.cc @@ -1404,7 +1421,9 @@ get_proc_name (const char *name, gfc_symbol **result, bool module_fcn_entry) /* Trap declarations of attributes in encompassing scope. The signature for this is that ts.kind is nonzero for no-CLASS entity. For a CLASS entity, ts.kind is zero. */ - if ((sym->ts.kind != 0 || sym->ts.type == BT_CLASS) + if ((sym->ts.kind != 0 + || sym->ts.type == BT_CLASS + || sym->ts.type == BT_DERIVED) && !sym->attr.implicit_type && sym->attr.proc == 0 && gfc_current_ns->parent != NULL @@ -7622,6 +7641,10 @@ gfc_match_function_decl (void) if (current_ts.type != BT_UNKNOWN && !gfc_add_type (result, _ts, _current_locus)) goto cleanup; + if (current_ts.type != BT_UNKNOWN + && sym->ts.type != BT_UNKNOWN + && sym->ts.type != current_ts.type) + goto cleanup; sym->result = result; }
[Bug fortran/104351] ICE in gfc_generate_initializer, at fortran/expr.cc:5140
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104351 G. Steinmetz changed: What|Removed |Added Keywords||ice-on-invalid-code --- Comment #1 from G. Steinmetz --- Without a result-name : $ cat z2.f90 program p implicit none type t end type type(t) :: f contains real function f() f = 0.0 end end $ gfortran-12-20220130 -c z2.f90 z2.f90:7:20: 7 |real function f() |1 Error: Symbol 'f' at (1) already has basic type of DERIVED z2.f90:8:8: 8 | f = 0.0 |1 Error: Symbol 'f' at (1) has already been host associated z2.f90:1:9: 1 | program p | 1 .. 10 | end | 2 Error: Two main PROGRAMs at (1) and (2)