https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92956

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Created attachment 47508
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47508&action=edit
-fdump-tree-strlen dump of gcc/testsuite/gfortran.dg/lto/pr87689_*.f

As requested, the output of:
$ gfortran-trunk -O2 -flto -flto-partition=1to1 -fno-use-linker-plugin
gfortran.dg/lto/pr87689_* -fdump-tree-strlen
$ head -n 2000000000 pr87689_0.f.180t.strlen1 pr87689_1.f.180t.strlen1 >
strlen.txt


I think the following causes the confusion:
  character(kind=1)[1:1] & restrict c,
  …  
  _7 = (*c_15(D))[1]{lb: 1 sz: 1};

'c' is a string of length 1 but the lower bound is also 1, hence "c[1]"
accesses the first element of the string.

I wonder whether you case assumes that the lower bound is always 0? – On the
other hand, this issue only appears with inlining (and the specified LTO
options), w/o there is no warning.

Reply via email to