[Bug fortran/92956] 'libgomp.fortran/examples-4/async_target-2.f90' offloading compilation regression

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Dec 17 09:21:00 GMT 2019


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

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Created attachment 47512
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47512&action=edit
-fdump-tree-strlen for both host run (async_target-2.f90.180t.strlen1, 1639
lines) and LTO nvptx run (async_target-2.o.180t.strlen1, 563 l.)

(In reply to Thomas Schwinge from comment #6)
> but I'll note that -- as we've seen in PR92952 -- it's actually useful in
> other scenarios
I think it can be useful in corner cases for Fortran for code written such that
FE compiler cannot check it at compile time. With explicitly writing bounds, it
can also be useful for a single TU, e.g.
subroutine str(n)
  integer :: n
  character(len=n) :: str  ! n = not known without call-argument propagation
  str(n:n+2) = 'abc' ! writes 2 bytes out of bounds

Thus, you should consider to enable it for all languages - or at least Fortran
in addition.


> This problem persists, thus:

I can confirm that the issue has been fixed for gfortran.dg/lto/pr87689_*,
but not for libgomp.fortran/examples-4/async_target-2.f90


Using the same options as for async_target-2.f90, it also fails without actual
offloading:

gfortran-trunk -fopenmp -O3 -flto -flto-partition=1to1 -fno-use-linker-plugin
testsuite/libgomp.fortran/examples-4/async_target-2.f90 -fdump-tree-strlen


testsuite/libgomp.fortran/examples-4/async_target-2.f90: In function
‘vec_mult_._omp_fn.2’:
testsuite/libgomp.fortran/examples-4/async_target-2.f90:34: warning: writing 2
bytes into a region of size 1 [-Wstringop-overflow=]
   34 |         allocate (v1(N), v2(N))
      | 
lto1: note: at offset 0 to object ‘rank’ with size 1 declared here
testsuite/libgomp.fortran/examples-4/async_target-2.f90:34: warning: writing 2
bytes into a region of size 1 [-Wstringop-overflow=]
lto1: note: at offset 0 to object ‘rank’ with size 1 declared here

 * * *

With offloading, it fails for:

10.0.0/accel/nvptx-none/lto1 -fdump-tree-strlen -quiet -dumpbase
async_target-2.o -m64 -mgomp -auxbase async_target-2 -O3 -version -fno-openacc
-fno-pie -foffload-abi=lp64 -fopenmp @/tmp/ccarNfXs -o async_target-2.s

 * * *

I have now attached both -fdump-tree-strlen


More information about the Gcc-bugs mailing list