https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71959
Bug ID: 71959
Summary: [OpenACC] #pragma acc parallel leads to segfault in
x86_64-pc-linux-gnu-accel-nvptx-none-gcc
Product: gcc
Version: 6.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
Target Milestone: ---
Created attachment 38947
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38947&action=edit
Source files and -save-temps files
I'm trying to modify libstdc++ by adding GPU offloaded code in omp_loop.h (my
version attached). I test the code using the attached measureParallel.cpp file.
Compiling the code using the following command:
> g++ -v -save-temps -Wall -Wextra measureParallel.cpp -D_GLIBCXX_PARALLEL
> -lpthread -fopenacc -foffload=nvptx-none -foffload="-O3" -O3 -o
> measureParallel.autotuned
gives me the following output:
> Using built-in specs.
> COLLECT_GCC=g++
> COLLECT_LTO_WRAPPER=/home/thonfeld.net/chris/git/gcc
> offload/install/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.1.0/lto-wrapper
> OFFLOAD_TARGET_NAMES=nvptx-none
> Target: x86_64-pc-linux-gnu
> Configured with:
> /home/thonfeld.net/chris/git/gcc-offload/source/gcc-6.1.0/configure --prefix=
> --disable-bootstrap --enable-languages=c,c++,fortran,lto --disable-multilib
> --enable-offload-targets=nvptx-none=/home/thonfeld.net/chris/git/gcc-offload/install
> --with-cuda-driver-include=/include CC='gcc -m64' CXX='g++ -m64'
> --with-sysroot= : (reconfigured)
> /home/thonfeld.net/chris/git/gcc-offload/source/gcc-6.1.0/configure --prefix=
> --disable-bootstrap --enable-languages=c,c++,fortran,lto --disable-multilib
> --enable-offload-targets=nvptx-none=/home/thonfeld.net/chris/git/gcc-offload/install
> --with-cuda-driver-include=/include CC='gcc -m64' CXX='g++ -m64'
> --with-sysroot=
> Thread model: posix
> gcc version 6.1.0 (GCC)
> COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-D'
> '_GLIBCXX_PARALLEL' '-fopenacc' '-foffload=nvptx-none' '-foffload=-O3' '-O3'
> '-o' 'measureParallel.autotuned' '-shared-libgcc' '-mtune=generic'
> '-march=x86-64' '-pthread'
>
> /home/thonfeld.net/chris/git/gcc-offload/install/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.1.0/cc1plus
> -E -quiet -v -imultiarch x86_64-linux-gnu -iprefix
> /home/thonfeld.net/chris/git/gcc-offload/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/
> -D_GNU_SOURCE -D_REENTRANT -D_GLIBCXX_PARALLEL measureParallel.cpp
> -mtune=generic -march=x86-64 -Wall -Wextra -fopenacc -foffload=nvptx-none
> -foffload=-O3 -O3 -fpch-preprocess -o measureParallel.ii
> ignoring nonexistent directory
> "/home/thonfeld.net/chris/git/gcc-offload/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../x86_64-pc-linux-gnu/include"
> ignoring nonexistent directory
> "/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0"
> ignoring nonexistent directory
> "/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/x86_64-pc-linux-gnu"
> ignoring nonexistent directory
> "/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../include/c++/6.1.0/backward"
> ignoring duplicate directory
> "/home/thonfeld.net/chris/git/gcc-offload/install/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/6.1.0/include"
> ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
> ignoring duplicate directory
> "/home/thonfeld.net/chris/git/gcc-offload/install/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/6.1.0/include-fixed"
> ignoring nonexistent directory
> "/home/thonfeld.net/chris/git/gcc-offload/install/bin/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../x86_64-pc-linux-gnu/include"
> #include "..." search starts here:
> #include <...> search starts here:
>
> /home/thonfeld.net/chris/git/masterarbeit-chris/code/submodules/libtuning/include
>
> /home/thonfeld.net/chris/git/gcc-offload/install/include/c++/6.1.0/x86_64-pc-linux-gnu
> /home/thonfeld.net/chris/git/gcc-offload/install/include/c++/6.1.0
> .
>
> /home/thonfeld.net/chris/git/gcc-offload/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/include
>
> /home/thonfeld.net/chris/git/gcc-offload/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/include-fixed
> /usr/local/include
> /home/thonfeld.net/chris/git/gcc-offload/install/bin/../lib/gcc/../../include
> /usr/include/x86_64-linux-gnu
> /usr/include
> End of search list.
> COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-D'
> '_GLIBCXX_PARALLEL' '-fopenacc' '-foffload=nvptx-none' '-foffload=-O3' '-O3'
> '-o' 'measureParallel.autotuned' '-shared-libgcc' '-mtune=generic'
> '-march=x86-64' '-pthread'
>
> /home/thonfeld.net/chris/git/gcc-offload/install/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.1.0/cc1plus
> -fpreprocessed measureParallel.ii -quiet -dumpbase measureParallel.cpp
> -mtune=generic -march=x86-64 -auxbase measureParallel -O3 -Wall -Wextra
> -version -fopenacc -foffload=nvptx-none - foffload=-O3 -o measureParallel.s
> GNU C++14 (GCC) version 6.1.0 (x86_64-pc-linux-gnu)
> compiled by GNU C version 5.3.1 20160519, GMP version 4.3.2, MPFR
> version 2.4.2, MPC version 0.8.1, isl version 0.15
> GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
> GNU C++14 (GCC) version 6.1.0 (x86_64-pc-linux-gnu)
> compiled by GNU C version 5.3.1 20160519, GMP version 4.3.2, MPFR
> version 2.4.2, MPC version 0.8.1, isl version 0.15
> GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
> Compiler executable checksum: fbffdca0529e9c8c85fda4bd9f92f484
> COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-D'
> '_GLIBCXX_PARALLEL' '-fopenacc' '-foffload=nvptx-none' '-foffload=-O3' '-O3'
> '-o' 'measureParallel.autotuned' '-shared-libgcc' '-mtune=generic'
> '-march=x86-64' '-pthread'
> as -v --64 -o measureParallel.o measureParallel.s
> GNU assembler version 2.26 (x86_64-linux-gnu) using BFD version (GNU Binutils
> for Debian) 2.26
> COMPILER_PATH=/home/thonfeld.net/chris/git/gcc-offload/install/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.1.0/:/home/thonfeld.net/chris/git/gcc-offload/install/bin/../libexec/gcc/
> LIBRARY_PATH=/home/thonfeld.net/chris/git/gcc-offload/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/:/home/thonfeld.net/chris/git/gcc-offload/install/bin/../lib/gcc/:/home/thonfeld.net/chris/git/gcc-offload/install/lib64/../lib64/:/home/thonfeld.net/chris/git/gcc-
>
> offload/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../lib64/:/lib/x86_64-linux-gnu/:/lib/../lib64/:/usr/lib/x86_64-linux-gnu/:/home/thonfeld.net/chris/git/masterarbeit-chris/code/submodules/libtuning/lib/:/home/thonfeld.net/chris/git/gcc-offload/install/lib64/:./:/home/thonfeld.net/chris/git/gcc-offload/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../:/lib/:/usr/lib/
> Reading specs from
> /home/thonfeld.net/chris/git/gcc-offload/install/lib64/../lib64/libgomp.spec
> COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-D'
> '_GLIBCXX_PARALLEL' '-fopenacc' '-foffload=nvptx-none' '-foffload=-O3' '-O3'
> '-o' 'measureParallel.autotuned' '-shared-libgcc' '-mtune=generic'
> '-march=x86-64' '-pthread'
>
> /home/thonfeld.net/chris/git/gcc-offload/install/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.1.0/collect2
> -plugin
> /home/thonfeld.net/chris/git/gcc-offload/install/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.1.0/liblto_plugin.so
>
> -plugin-opt=/home/thonfeld.net/chris/git/gcc-offload/install/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.1.0/lto-wrapper
> -plugin-opt=-fresolution=measureParallel.res
> -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc
> -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-lc
> -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --sysroot=
> --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o
> measureParallel.autotuned /usr/lib/x86_64-linux-gnu/crt1.o
> /usr/lib/x86_64-linux-gnu/crti.o
> /home/thonfeld.net/chris/git/gcc-offload/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/crtbegin.o
>
> /home/thonfeld.net/chris/git/gcc-offload/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/crtoffloadbegin.o
>
> -L/home/thonfeld.net/chris/git/gcc-offload/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0
> -L/home/thonfeld.net/chris/git/gcc-offload/install/bin/../lib/gcc
> -L/home/thonfeld.net/chris/git/gcc-offload/install/lib64/../lib64
> -L/home/thonfeld.net/chris/git/gcc-offload/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../lib64
> -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu
> -L/home/thonfeld.net/chris/git/masterarbeit-chris/code/submodules/libtuning/lib
> -L/home/thonfeld.net/chris/git/gcc-offload/install/lib64 -L.
> -L/home/thonfeld.net/chris/git/gcc-offload/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../..
> measureParallel.o -lpthread -lstdc++ -lm -lgomp -lgcc_s -lgcc -lpthread -lc
> -lgcc_s -lgcc
> /home/thonfeld.net/chris/git/gcc-offload/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/crtend.o
> /usr/lib/x86_64-linux-gnu/crtn.o
> /home/thonfeld.net/chris/git/gcc-offload/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/crtoffloadend.o
> [Leaving LTRANS /tmp/cciqMZUH.ofldlist]
> /home/thonfeld.net/chris/git/gcc-offload/install/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.1.0//accel/nvptx-none/mkoffload
> @/tmp/cclB99nc
> x86_64-pc-linux-gnu-accel-nvptx-none-gcc @/tmp/ccsC2ToF
> Using built-in specs.
> COLLECT_GCC=x86_64-pc-linux-gnu-accel-nvptx-none-gcc
> COLLECT_LTO_WRAPPER=/home/thonfeld.net/chris/git/gcc-offload/install/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.1.0/accel/nvptx-none/lto-wrapper
> Target: nvptx-none
> Configured with:
> /home/thonfeld.net/chris/git/gcc-offload/source/gcc-6.1.0/configure --prefix=
> --target=nvptx-none --enable-as-accelerator-for=x86_64-pc-linux-gnu
> --enable-languages=c,c++,fortran,lto --enable-checking=yes,df,fold,rtl
> --disable-multilib --with-sysroot=/nvptx-none
> --with-build-sysroot=/home/thonfeld.net/chris/git/gcc-offload/install/nvptx-none
>
> --with-build-time-tools=/home/thonfeld.net/chris/git/gcc-offload/install/nvptx-none/bin
> --disable-sjlj-exceptions --enable-newlib-io-long-long CC='gcc -m64'
> CXX='g++ -m64'
> Thread model: single
> gcc version 6.1.0 (GCC)
> COLLECT_GCC_OPTIONS='-save-temps' '-v' '-m64' '-save-temps' '-v'
> '-fexceptions' '-fmath-errno' '-fsigned-zeros' '-ftrapping-math' '-fno-trapv'
> '-fno-openmp' '-foffload-abi=lp64' '-O3' '-fopenacc' '-O3' '-O3' '-o'
> '/tmp/cc2k63Sa.mkoffload'
>
> /home/thonfeld.net/chris/git/gcc-offload/install/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.1.0/accel/nvptx-none/lto1
> -quiet -dumpbase measureParallel.o -m64 -auxbase measureParallel -O3 -O3 -O3
> -version -fexceptions -fmath-errno -fsigned-zeros -ftrapping-math -fno-trapv
> -fno-openmp -foffload- abi=lp64 -fopenacc @/tmp/ccRiH5jG -o measureParallel.s
> GNU GIMPLE (GCC) version 6.1.0 (nvptx-none)
> compiled by GNU C version 5.3.1 20160519, GMP version 4.3.2, MPFR
> version 2.4.2, MPC version 0.8.1, isl version 0.15
> GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
> GNU GIMPLE (GCC) version 6.1.0 (nvptx-none)
> compiled by GNU C version 5.3.1 20160519, GMP version 4.3.2, MPFR
> version 2.4.2, MPC version 0.8.1, isl version 0.15
> GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
> COLLECT_GCC_OPTIONS='-save-temps' '-v' '-m64' '-save-temps' '-v'
> '-fexceptions' '-fmath-errno' '-fsigned-zeros' '-ftrapping-math' '-fno-trapv'
> '-fno-openmp' '-foffload-abi=lp64' '-O3' '-fopenacc' '-O3' '-O3' '-o'
> '/tmp/cc2k63Sa.mkoffload'
>
> /home/thonfeld.net/chris/git/gcc-offload/install/bin/../lib/gcc/x86_64-pc-linux-gnu/6.1.0/accel/nvptx-none/../../../../../../nvptx-none/bin/as
> -o /tmp/cchZvV0a.o measureParallel.s
> x86_64-pc-linux-gnu-accel-nvptx-none-gcc: internal compiler error:
> Segmentation fault (program as)
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <http://gcc.gnu.org/bugs.html> for instructions.
> mkoffload: fatal error: x86_64-pc-linux-gnu-accel-nvptx-none-gcc returned 4
> exit status
> compilation terminated.
> [Leaving /tmp/ccaHienG.c]
> [Leaving /tmp/cc2k63Sa.mkoffload]
> lto-wrapper: fatal error:
> /home/thonfeld.net/chris/git/gcc-offload/install/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.1.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
The code compiles just fine when I remove lines 136 and 137 from omp_loop.h
Sorry for attaching an archive but I can't reproduce the error with just one
file.
Let me know if you need any more information.