[Bug fortran/87448] ICE at trans-expr:3417 in allocate statement with type signature using an associated variable
pault at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Nov 1 18:08:00 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87448
Paul Thomas <pault at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pault at gcc dot gnu.org
--- Comment #4 from Paul Thomas <pault at gcc dot gnu.org> ---
Created attachment 56484
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56484&action=edit
Fix for this PR
Somehow this missed being a blocker for the ASSOCIATE meta-bug.
The patch is so unbelievably simple that I am going to think about it for 24
hours, even though it regtests just fine :-)
module mod
implicit none
public
contains
function fun(cs) result(rs)
character(len=:), allocatable :: rs
character(len=*), intent(in) :: cs
associate(l => len(cs))
allocate(character(len=1+l) :: rs)
write (rs, '(i5)') l
end associate
end function fun
end module mod
use mod
character(:), allocatable :: res
res = fun("abcd")
if (res /= ' 4') stop 1
end
Gives the expected result.
Paul
More information about the Gcc-bugs
mailing list