[Bug fortran/100273] [11/12/13/14/15 Regression] ICE in gfc_create_module_variable, at fortran/trans-decl.c:5352
anlauf at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jul 16 18:29:38 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100273
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org
--- Comment #7 from anlauf at gcc dot gnu.org ---
(In reply to anlauf from comment #2)
> Looks very related to the len_trim issue in pr84868. Possibly a duplicate.
After the fix for pr84868, the issue still persists.
Reduced testcase:
module m
implicit none
private
contains
subroutine s()
! character, parameter :: c(3) = ['*', '+', '-'] ! works when placed here
contains
function f(n) result(z)
integer, intent(in) :: n
character, parameter :: c(3) = ['*', '+', '-'] ! ICE when here
character(len_trim(c(n))) :: z
z = c(n)
end
end
end
We hit the assert in gfc_create_module_variable:
gcc_assert (sym->ns->proc_name->attr.flavor == FL_MODULE
|| (sym->ns->parent->proc_name->attr.flavor == FL_MODULE
&& sym->fn_result_spec));
(gdb) p sym->ns->proc_name->attr.flavor
$1 = FL_PROCEDURE
(gdb) p sym->ns->parent->proc_name->attr.flavor
$2 = FL_PROCEDURE
For the working version from above, one finds:
(gdb) p sym->ns->proc_name->attr.flavor
$3 = FL_PROCEDURE
(gdb) p sym->ns->parent->proc_name->attr.flavor
$4 = FL_MODULE
More information about the Gcc-bugs
mailing list