[Bug fortran/86372] [8/9 Regression] Segfault on ASSOCIATE statement with CHARACTER variable
janus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 2 09:11:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86372
janus at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
--- Comment #1 from janus at gcc dot gnu.org ---
Test case:
program xxx
character(len=50) :: s
s = repeat('*', len(s))
call sub(s)
print *, s
contains
subroutine sub(str)
character(len=*), intent(inout) :: str
associate (substr => str(3:5))
substr = '123'
end associate
end subroutine
end
With gfortran version 5 to 7 it compiles ok and prints at runtime:
**************************************************
This is already wrong, since the string should be modified is the subroutine.
With gfortran 8 and trunk there is even a segfault at runtime (on the line
"substr = '123'"), and the warning mentioned in PR 56670 comment 5:
substr = '123'
Warning: ‘.substr’ is used uninitialized in this function [-Wuninitialized]
More information about the Gcc-bugs
mailing list