https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101919
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org
--- Comment #2 from anlauf at gcc dot gnu.org ---
Further reduced:
program foo
implicit none
character(len=100) :: c = ' ', d = ' '
integer :: i
i = len_trim (c)
d = c(13:i)
end program
We do not get a warning if the initialization of 'd' is removed,
i.e. it is changed from static to automatic. The above gives:
pr101919.f90: In function 'foo':
pr101919.f90:6:13: warning: '__builtin_memcpy' reading 100 bytes from a region
of size 88 [-Wstringop-overread]
6 | d = c(13:i)
| ^
pr101919.f90:3:25: note: at offset 12 into source object 'c' of size 100
3 | character(len=100) :: c = ' ', d = ' '
| ^