[Bug libgomp/93510] New: [gfortran] OpenMP target teams distribute reduction with multiply operator gives incorrect results
jhdavis at udel dot edu
gcc-bugzilla@gcc.gnu.org
Thu Jan 30 14:27:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93510
Bug ID: 93510
Summary: [gfortran] OpenMP target teams distribute reduction
with multiply operator gives incorrect results
Product: gcc
Version: 9.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libgomp
Assignee: unassigned at gcc dot gnu.org
Reporter: jhdavis at udel dot edu
CC: jakub at gcc dot gnu.org
Target Milestone: ---
Created attachment 47739
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47739&action=edit
Reproducible for offloaded reduction multiply bug
Hello,
This from the SOLLVE team.
--- SUMMARY ---
We have a test of an multiplication reduction with a target teams distribute
construct that is not giving correct results. The independent reproducible is
attached. See the version in the test suite here:
https://github.com/SOLLVE/sollve_vv/blob/new_test/test_target_teams_distribute_reduction.F90/tests/4.5/target_teams_distribute/test_target_teams_distribute_reduction_multiply.F90
--- DETAILS ---
gfortran version: 9.2.0
System: x86_64-pc-linux-gnu
Config options:
../gcc9.2/configure --enable-offload-targets=nvptx-none
--with-cuda-driver-include=/software/apps/cuda/9.2//include
--with-cuda-driver-lib=/software/apps/cuda/9.2//lib64 --disable-bootstrap
--disable-multilib --enable-languages=c,c++,fortran,lto
--prefix=/software/apps/gcc/9.2
Command line to trigger bug:
gfortran -O3 -fopenmp -foffload="-lm" -lm -ffree-line-length-none
reduction_multiply_bug.F90 -o reduction_multiply_bug.F90.o
./reduction_multiply_bug.F90.o
No compiler output. Runtime output:
Device got 0 but host got -306950144
Test failed with 1 errors
Adding -fsanitize=undefined gives this compiler error:
unresolved symbol __ubsan_handle_add_overflow
collect2: error: ld returned 1 exit status
mkoffload: fatal error: x86_64-pc-linux-gnu-accel-nvptx-none-gcc returned 1
exit status
compilation terminated.
lto-wrapper: fatal error:
/home/capsl_sysadmin/software/apps/gcc/9.2/bin/../libexec/gcc/x86_64-pc-linux-gnu/9.2.0//accel/nvptx-none/mkoffload
returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
Adding the options -fsanitize=undefined -fwrapv gives this runtime error:
reduction_multiply_bug.F90:48: runtime error: load of address
0x7ffde33849d0 with insufficient space for an object of type 'integer(kind=4)'
0x7ffde33849d0: note: pointer points here
02 00 00 00 f9 b4 2c e7 02 b3 ea 3f 08 9e 9a 80 3e 36 d7 3f 44 87 91 f1
b7 b4 ec 3f 54 93 a8 4c
^
In the version of the test in our suite, if the INTEGERs on line 28 are changed
to (kind=8) *and* the -O3 is changed to -O1, then the test passes. However, we
do not expect an overflow on any INTs here because the values being multiplied
are set to 1s and 2s on line 36, and regardless, I cannot get this particular
behavior to replicate in the independent reproducible.
Best,
Josh Davis
More information about the Gcc-bugs
mailing list