aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-if-conv.c
diff options
context:
space:
mode:
authorTobias Burnus <tburnus@baylibre.com>2025-06-17 11:33:09 +0200
committerTobias Burnus <tburnus@baylibre.com>2025-06-17 11:45:12 +0200
commit9ee74468c5a145b0926609d3066af059eeb2ad0c (patch)
tree4937c2c5ecd0d6282f6c6f36de86cf7de2e252cc /gcc/tree-if-conv.c
parent2ed152968611a87c80a510ac7ceb24ab53ccc4be (diff)
downloadgcc-9ee74468c5a145b0926609d3066af059eeb2ad0c.zip
gcc-9ee74468c5a145b0926609d3066af059eeb2ad0c.tar.gz
gcc-9ee74468c5a145b0926609d3066af059eeb2ad0c.tar.bz2
OpenMP: Fix implicit 'declare target' for <ostream>
libstdc++-v3/include/std/ostream contains: namespace std _GLIBCXX_VISIBILITY(default) { ... template<typename _CharT, typename _Traits> inline basic_ostream<_CharT, _Traits>& endl(basic_ostream<_CharT, _Traits>& __os) { return flush(__os.put(__os.widen('\n'))); } ... #include <bits/ostream.tcc> and the latter, libstdc++-v3/include/bits/ostream.tcc, has: // Inhibit implicit instantiations for required instantiations, // which are defined via explicit instantiations elsewhere. #if _GLIBCXX_EXTERN_TEMPLATE extern template class basic_ostream<char>; extern template ostream& endl(ostream&); Before this commit, omp_discover_declare_target_tgt_fn_r marked 'endl' as (implicitly) declare target - but not the calls in it due to the 'extern' (DECL_EXTERNAL). Thanks to inlining and as 'endl' is (therefore) not used and, hence, discarded by the linker; hencet, it works with -O0 and -O1. However, as the (unused) function still exits, IPA CP (enabled by -O2) will try to do constant-value propagation and fails as the definition of 'widen' is not available. Solution is to still walk 'endl' despite being an 'extern(al)' decl; this has been restricted for now to DECL_DECLARED_INLINE_P. gcc/ChangeLog: * omp-offload.cc (omp_discover_declare_target_tgt_fn_r): Also walk external functions that are declare inline (and have a DECL_SAVED_TREE). libgomp/ChangeLog: * testsuite/libgomp.c++/declare_target-2.C: New test. (cherry picked from commit ea43b99537591b1103da3961c61f1cbfae968859)
Diffstat (limited to 'gcc/tree-if-conv.c')
0 files changed, 0 insertions, 0 deletions