https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96390
Bug ID: 96390
Summary: [OpenMP] Link errors on the offload side for C++ code
with templates
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Keywords: openmp
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
CC: jakub at gcc dot gnu.org
Target Milestone: ---
sollve_vv's tests/4.5/application_kernels/gemv_target_reduction.cpp fails to
link when compiling with -O0.
Note: with -O1 and higher, it becomes a host-only code, which works.
Testcase:
https://github.com/SOLLVE/sollve_vv/blob/master/tests/4.5/application_kernels/alpaka_complex_template.cpp
g++ -fopenmp alpaka_complex_template.cpp -O0
Namely, with GCN:
ld: error: undefined symbol: S<0>::S()
>>> referenced by /tmp/ccGooH3g.o:(main._omp_fn.2)
>>> referenced by /tmp/ccGooH3g.o:(main._omp_fn.2)
ld: error: undefined symbol: V<1>::V<unsigned long, void>(unsigned long&&)
>>> referenced by /tmp/ccGooH3g.o:(main._omp_fn.2)
>>> referenced by /tmp/ccGooH3g.o:(main._omp_fn.2)
And likewise with nvptx:
libgomp: Link error log ptxas application ptx input, line 262; error : Label
expected for argument 0 of instruction 'call'
ptxas application ptx input, line 262; error : Function '_ZN1SILi0EEC1Ev' not
declared in this scope
ptxas application ptx input, line 262; error : Call target not recognized
ptxas application ptx input, line 276; error : Label expected for argument 0
of instruction 'call'
ptxas application ptx input, line 276; error : Function
'_ZN1VILi1EEC1ImvEEOT_' not declared in this scope
which demangles to the same symbols.