https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71499
Bug ID: 71499
Summary: ICE in LTO1 when attempting NVPTX offloading
(-fopenacc)
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
Assignee: unassigned at gcc dot gnu.org
Reporter: bisqwit at iki dot fi
Target Milestone: ---
Summary: Error message:
lto1: internal compiler error: in input_overwrite_node, at
lto-cgraph.c:1203
On GCC 6.1.0
Compiling this code:
void test()
{
}
int main()
{
#pragma acc parallel
test();
}
With this commandline:
gcc tmpe.c -O0 -fopenacc -v
Complete output of GCC:
Using built-in specs.
COLLECT_GCC=/usr/local/bin/gcc
COLLECT_LTO_WRAPPER=/usr/local/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: ../configure --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
--enable-offload-targets=nvptx-none=/usr/local/nvptx-none
--enable-languages=c,c++ --with-cuda-driver=/usr --disable-bootstrap
Thread model: posix
gcc version 6.1.0 (GCC)
COLLECT_GCC_OPTIONS='-O0' '-fopenacc' '-v' '-mtune=generic' '-march=x86-64'
'-pthread'
/usr/local/libexec/gcc/x86_64-pc-linux-gnu/6.1.0/cc1 -quiet -v -imultiarch
x86_64-linux-gnu -D_REENTRANT tmpe.c -quiet -dumpbase tmpe.c -mtune=generic
-march=x86-64 -auxbase tmpe -O0 -version -fopenacc -o /tmp/ccPHnCW0.s
GNU C11 (GCC) version 6.1.0 (x86_64-pc-linux-gnu)
compiled by GNU C version 6.1.0, GMP version 6.0.0, MPFR version 3.1.4,
MPC version 1.0.3, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/local/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/lib/gcc/x86_64-pc-linux-gnu/6.1.0/include
/usr/local/include
/usr/local/lib/gcc/x86_64-pc-linux-gnu/6.1.0/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
GNU C11 (GCC) version 6.1.0 (x86_64-pc-linux-gnu)
compiled by GNU C version 6.1.0, GMP version 6.0.0, MPFR version 3.1.4,
MPC version 1.0.3, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 1c46fde4e47f1157bf1461541c266a3c
COLLECT_GCC_OPTIONS='-O0' '-fopenacc' '-v' '-mtune=generic' '-march=x86-64'
'-pthread'
as -v --64 -o /tmp/ccd60m4w.o /tmp/ccPHnCW0.s
GNU assembler version 2.26 (x86_64-linux-gnu) using BFD version (GNU
Binutils for Debian) 2.26
COMPILER_PATH=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/6.1.0/:/usr/local/libexec/gcc/x86_64-pc-linux-gnu/6.1.0/:/usr/local/libexec/gcc/x86_64-pc-linux-gnu/:/usr/local/lib/gcc/x86_64-pc-linux-gnu/6.1.0/:/usr/local/lib/gcc/x86_64-pc-linux-gnu/
LIBRARY_PATH=/usr/local/lib/gcc/x86_64-pc-linux-gnu/6.1.0/:/usr/local/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../lib64/:/lib/x86_64-linux-gnu/:/lib/../lib64/:/usr/lib/x86_64-linux-gnu/:/usr/local/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../:/lib/:/usr/lib/
Reading specs from
/usr/local/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../../../lib64/libgomp.spec
COLLECT_GCC_OPTIONS='-O0' '-fopenacc' '-v' '-mtune=generic' '-march=x86-64'
'-pthread'
/usr/local/libexec/gcc/x86_64-pc-linux-gnu/6.1.0/collect2 -plugin
/usr/local/libexec/gcc/x86_64-pc-linux-gnu/6.1.0/liblto_plugin.so
-plugin-opt=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/6.1.0/lto-wrapper
-plugin-opt=-fresolution=/tmp/ccPr7Oc3.res -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lpthread
-plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_x86_64 -dynamic-linker
/lib64/ld-linux-x86-64.so.2 /usr/lib/x86_64-linux-gnu/crt1.o
/usr/lib/x86_64-linux-gnu/crti.o
/usr/local/lib/gcc/x86_64-pc-linux-gnu/6.1.0/crtbegin.o
/usr/local/lib/gcc/x86_64-pc-linux-gnu/6.1.0/crtoffloadbegin.o
-L/usr/local/lib/gcc/x86_64-pc-linux-gnu/6.1.0
-L/usr/local/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/usr/local/lib/gcc/x86_64-pc-linux-gnu/6.1.0/../../.. /tmp/ccd60m4w.o -lgomp
-lgcc --as-needed -lgcc_s --no-as-needed -lpthread -lc -lgcc --as-needed
-lgcc_s --no-as-needed /usr/local/lib/gcc/x86_64-pc-linux-gnu/6.1.0/crtend.o
/usr/lib/x86_64-linux-gnu/crtn.o
/usr/local/lib/gcc/x86_64-pc-linux-gnu/6.1.0/crtoffloadend.o
/usr/local/libexec/gcc/x86_64-pc-linux-gnu/6.1.0//accel/nvptx-none/mkoffload
@/tmp/ccDURU7y
/usr/local/bin/x86_64-pc-linux-gnu-accel-nvptx-none-gcc @/tmp/cchbn3g5
Using built-in specs.
COLLECT_GCC=/usr/local/bin/x86_64-pc-linux-gnu-accel-nvptx-none-gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/6.1.0/accel/nvptx-none/lto-wrapper
Target: nvptx-none
Configured with: ../configure --target=nvptx-none
--enable-as-accelerator-for=x86_64-pc-linux-gnu --disable-sjlj-exceptions
--enable-newlib-io-long-long --enable-languages=c,c++
--with-build-time-tools=/usr/local/nvptx-none/bin : (reconfigured) ../configure
--target=nvptx-none --enable-as-accelerator-for=x86_64-pc-linux-gnu
--disable-sjlj-exceptions --enable-newlib-io-long-long --enable-languages=c,c++
--with-build-time-tools=/usr/local/nvptx-none/bin
Thread model: single
gcc version 6.1.0 (GCC)
COLLECT_GCC_OPTIONS='-v' '-m64' '-v' '-fmath-errno' '-fsigned-zeros'
'-ftrapping-math' '-fno-trapv' '-fno-strict-overflow' '-fno-openmp'
'-foffload-abi=lp64' '-O0' '-fopenacc' '-o' '/tmp/ccbsSD6y.mkoffload'
/usr/local/libexec/gcc/x86_64-pc-linux-gnu/6.1.0/accel/nvptx-none/lto1
-quiet -dumpbase ccd60m4w.o -m64 -auxbase ccd60m4w -O0 -version -fmath-errno
-fsigned-zeros -ftrapping-math -fno-trapv -fno-strict-overflow -fno-openmp
-foffload-abi=lp64 -fopenacc @/tmp/ccBVSiU2 -o /tmp/ccSbKQ4y.s
GNU GIMPLE (GCC) version 6.1.0 (nvptx-none)
compiled by GNU C version 4.9.2, GMP version 6.0.0, MPFR version 3.1.4,
MPC version 1.0.3, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU GIMPLE (GCC) version 6.1.0 (nvptx-none)
compiled by GNU C version 4.9.2, GMP version 6.0.0, MPFR version 3.1.4,
MPC version 1.0.3, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
lto1: internal compiler error: in input_overwrite_node, at
lto-cgraph.c:1203
0x7984cd input_overwrite_node
../../gcc/lto-cgraph.c:1201
0x7984cd input_node
../../gcc/lto-cgraph.c:1296
0x7984cd input_cgraph_1
../../gcc/lto-cgraph.c:1546
0x7984cd input_symtab()
../../gcc/lto-cgraph.c:1849
0x53e23f read_cgraph_and_symbols
../../gcc/lto/lto.c:2856
0x53e23f lto_main()
../../gcc/lto/lto.c:3304
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
mkoffload: fatal error:
/usr/local/bin/x86_64-pc-linux-gnu-accel-nvptx-none-gcc returned 1 exit status
compilation terminated.
lto-wrapper: fatal error:
/usr/local/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
Operating system: Debian Jessie on x86_64.
GCC was installed using the following sequence of commands, after instructions
from https://gcc.gnu.org/wiki/Offloading:
apt-get install -t jessie-backports nvidia-cuda-toolkit libcuda1:i386
build-essential git gcc-multilib
apt-get install -t binutils/testing binutils-multiarch/testing
cd /usr/local/src
git clone https://github.com/MentorEmbedded/nvptx-tools
cd nvptx-tools
./configure; make -j8; make install
cd /usr/local/src
git clone https://github.com/MentorEmbedded/nvptx-newlib
cd /dev/shm
wget
ftp://ftp.uvsq.fr/pub/gcc/releases/gcc-6.1.0/gcc-6.1.0.tar.bz2
tar xvfj gcc-6.1.0.tar.bz2
cd gcc-6.1.0
mkdir build ; cd build
ln /usr/local/src/nvptx-newlib/newlib -s ../newlib
../configure --target=nvptx-none
--enable-as-accelerator-for=x86_64-pc-linux-gnu \
--disable-sjlj-exceptions --enable-newlib-io-long-long
\
--enable-languages=c,c++
--with-build-time-tools=/usr/local/nvptx-none/bin
make -j8 ; make install
rm -rf *
../configure --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu \
--target=x86_64-pc-linux-gnu \
--enable-offload-targets=nvptx-none=/usr/local/nvptx-none \
--enable-languages=c,c++ \
--with-cuda-driver=/usr \
--disable-bootstrap
make -j8 ; make install
The exact same error was also reproduced when --disable-bootstrap was not used.
For reference, the problems seems to be in the transfer of code from the host
compiler to the nvptx cross compiler. These individual commands run
successfully:
x86_64-pc-linux-gnu-accel-nvptx-none-gcc tmpe.c -S -o-
gcc tmpe.c -O0 -fopenacc -c
But if I run the host GCC separately like that, I get a different ICE from
mkoffload:
COLLECT_GCC=x86_64-pc-linux-gnu-accel-nvptx-none-gcc \
/usr/local/libexec/gcc/x86_64-pc-linux-gnu/6.1.0//accel/nvptx-none/mkoffload
tmpe.o
mkoffload: internal compiler error: in main, at
config/nvptx/mkoffload.c:502
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.