Summary: | [13 Regression] ice in modify_call, at ipa-param-manipulation.cc:700 with -std=c++14 -O3 -march=znver3 since r13-4685-g4834e9360f7bf4 | ||
---|---|---|---|
Product: | gcc | Reporter: | David Binderman <dcb314> |
Component: | ipa | Assignee: | Martin Jambor <jamborm> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | asolokha, jakub, jamborm, manuel.lauss, marxin, slyfox |
Priority: | P1 | Keywords: | ice-on-valid-code |
Version: | 13.0 | ||
Target Milestone: | 13.0 | ||
See Also: | https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108384 | ||
Host: | Target: | x86_64-linux-gnu | |
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2022-12-15 00:00:00 | |
Attachments: |
gzipped C++ source code
unreduced test case |
Description
David Binderman
2022-12-14 19:03:15 UTC
CPU is AMD Ryzen 7 5700G, so -march flag is zen3. Most likely one of the following revisions ranges caused the issue: r13-4705 - r13-4706 r13-4684 - r13-4691 Reduced C++ code seems to be: namespace std { template <int __v> struct integral_constant { static constexpr int value = __v; }; using true_type = integral_constant<true>; using false_type = integral_constant<false>; template <int> struct __conditional { template <typename _Tp, typename> using type = _Tp; }; template <bool _Cond, typename _If, typename _Else> using __conditional_t = typename __conditional<_Cond>::type<_If, _Else>; template <typename _Tp> struct remove_cv { using type = _Tp; }; template <typename _Tp> struct remove_reference { using type = _Tp; }; template <typename _Up> struct __decay_selector : __conditional_t<false_type ::value, remove_cv<_Up>, _Up> {}; template <typename _Tp> struct decay { using type = typename __decay_selector<_Tp>::type; }; template <typename _Tp> using decay_t = typename decay<_Tp>::type; template <bool, typename _Tp> using enable_if_t = _Tp; template <typename _Tp> _Tp &&forward(typename remove_reference<_Tp>::type &); long max(long __b) { if (__b) return __b; } } // namespace std enum layout_type { row_major }; template <class> struct svector { using size_type = long; using value_type = long; using const_reference = value_type; const_reference operator[](size_type) const; long *m_begin; }; template <class T> auto svector<T>::operator[](size_type idx) const -> const_reference { return m_begin[idx]; } template <class> struct xcontainer_inner_types; template <class, layout_type, class, class = int> class xarray_container; template <class, layout_type L = row_major, class A = int> using xarray = xarray_container<A, L, long>; template <class> struct xrange { using size_type = int; xrange(size_type, size_type) noexcept; size_type m_size; }; template <class, class, class> struct xrange_adaptor { xrange_adaptor(int, int, int) : m_start() {} std::enable_if_t<std::integral_constant<0>::value, xrange<long>> get(long size) { long __trans_tmp_8, __trans_tmp_7; if (m_start) std::max(size); if (m_stop) std::max(size); return xrange<long>(__trans_tmp_7, __trans_tmp_8); } int m_start; int m_stop; }; template <class A, class B> auto range(A, B stop_val) { return xrange_adaptor<A, B, int>(0, stop_val, int()); } template <class> struct slice_implementation_getter { template <class E, class SL> auto operator()(E e, SL slice, long index) { return get_slice(e, slice, index, std::integral_constant<1>()); } template <class E, class SL> auto get_slice(E, SL slice, long, std::true_type) { using int_type = std::decay_t<SL>; return slice < int_type() ?: slice; } }; template <class A, class B, class C> struct slice_implementation_getter<xrange_adaptor<A, B, C>> { template <class E, class SL> auto operator()(E e, SL adaptor, long index) { const svector<long> __trans_tmp_6 = e.shape(); long __trans_tmp_2 = __trans_tmp_6[index]; return adaptor.get(__trans_tmp_2); } }; long get_slice_implementation_index; template <class E, class SL> auto get_slice_implementation(E e, SL &&slice) { slice_implementation_getter<std::decay_t<SL>> getter; return getter(e, slice, get_slice_implementation_index); } template <class T> xrange<T>::xrange(size_type, size_type) noexcept {} template <class D> struct xcontainer { using derived_type = D; using inner_types = xcontainer_inner_types<D>; using inner_shape_type = typename inner_types::inner_shape_type; constexpr const inner_shape_type &shape() const noexcept; const derived_type &derived_cast() const &noexcept; }; template <class D> struct xstrided_container : xcontainer<D> { using base_type = xcontainer<D>; using typename base_type::inner_shape_type; const inner_shape_type &shape_impl() const noexcept; inner_shape_type m_shape; }; template <class D> constexpr auto xcontainer<D>::shape() const noexcept -> const inner_shape_type & { return derived_cast().shape_impl(); } template <class D> auto xcontainer<D>::derived_cast() const &noexcept -> const derived_type & { return *static_cast<const derived_type *>(this); } template <class D> auto xstrided_container<D>::shape_impl() const noexcept -> const inner_shape_type & { return m_shape; } template <class EC, layout_type L, class SC, class Tag> struct xcontainer_inner_types<xarray_container<EC, L, SC, Tag>> { using shape_type = SC; using inner_shape_type = shape_type; }; template <class, layout_type L, class, class> struct xarray_container : xstrided_container<xarray_container<double, L, svector<long>>> {}; struct xview { template <class CTA, class FSL> xview(CTA, FSL); }; template <class E, class... S> void make_view_impl(E e, S &&...slices) { using view_type = xview; view_type(get_slice_implementation(e, std::forward<S>(slices))...); } template <class E, class... S> void view(E e, S... slices) { make_view_impl(e, std::forward<S>(slices)...); } void TestBody() { xarray<double> a, arr; xrange_adaptor<int, int, int> __trans_tmp_3 = range(1, 4), __trans_tmp_4 = range(1, 3); view(a, 1, __trans_tmp_3); view(arr, 1, __trans_tmp_4); } Git bisect now running. Trying 15f04af347e3b65f. That revision seems good. Trying 7450b25566b7a738. For the reduced code, -march=zen3 not required. (In reply to David Binderman from comment #5) > That revision seems good. Trying 7450b25566b7a738. Seems good. Trying 512098a3316f07d4. That one seems bad. Trying 803a91330bf20174. Range seems to be [7450b25566b7a738..512098a3316f07d4], so some 9 commits. 7 of them are by Martin Jambor <mjambor@suse.cz>, one is a daily bump and one is unrelated. Over to Martin. 803a91330bf20174 seems bad, so trying 095a13eda2caf684. (In reply to David Binderman from comment #8) > 803a91330bf20174 seems bad, so trying 095a13eda2caf684. That seems bad, so trying 4834e9360f7bf42f. That's the bad revision. ipa: Better way of applying both IPA-CP and IPA-SRA (PR 103227) A bit more reduced test-case: namespace std { template <int __v> struct integral_constant { static constexpr int value = __v; }; template <typename _Tp> using decay_t = _Tp; template <bool, typename _Tp> using enable_if_t = _Tp; template <typename _Tp> _Tp &&forward(_Tp &); long max(long __b) { if (__b) return __b; } } // namespace std enum layout_type { row_major }; struct svector { long operator[](long) const; long *m_begin; }; auto svector::operator[](long idx) const -> long { return m_begin[idx]; } template <class> struct xcontainer_inner_types; template <class, layout_type, class, class = int> class xarray_container; template <class, layout_type L = row_major, class A = int> using xarray = xarray_container<A, L, long>; struct xrange { xrange() noexcept; int m_size; }; template <class, class, class> struct xrange_adaptor { xrange_adaptor(int, int, int) : m_start() {} std::enable_if_t<std::integral_constant<0>::value, xrange> get(long size) { if (m_start) std::max(size); if (m_stop) std::max(size); return xrange(); } int m_start; int m_stop; }; template <class A, class B> auto range(A, B stop_val) { return xrange_adaptor<A, B, int>(0, stop_val, int()); } template <class> struct slice_implementation_getter { template <class E, class SL> auto operator()(E e, SL slice, long index) { return get_slice(e, slice, index, std::integral_constant<1>()); } template <class E, class SL> auto get_slice(E, SL slice, long, std::integral_constant<true>) { return slice < std::decay_t<SL>() ?: slice; } }; template <class A, class B, class C> struct slice_implementation_getter<xrange_adaptor<A, B, C>> { template <class E, class SL> auto operator()(E e, SL adaptor, long index) { const svector __trans_tmp_6 = e.shape(); long __trans_tmp_2 = __trans_tmp_6[index]; return adaptor.get(__trans_tmp_2); } }; long get_slice_implementation_index; template <class E, class SL> auto get_slice_implementation(E e, SL &&slice) { slice_implementation_getter<std::decay_t<SL>> getter; return getter(e, slice, get_slice_implementation_index); } xrange::xrange() noexcept {} template <class D> struct xcontainer { using derived_type = D; using inner_shape_type = typename xcontainer_inner_types<D>::inner_shape_type; constexpr const inner_shape_type &shape() const noexcept; const derived_type &derived_cast() const &noexcept; }; template <class D> struct xstrided_container : xcontainer<D> { using typename xcontainer<D>::inner_shape_type; const inner_shape_type &shape_impl() const noexcept; inner_shape_type m_shape; }; template <class D> constexpr auto xcontainer<D>::shape() const noexcept -> const inner_shape_type & { return derived_cast().shape_impl(); } template <class D> auto xcontainer<D>::derived_cast() const &noexcept -> const derived_type & { return *static_cast<const derived_type *>(this); } template <class D> auto xstrided_container<D>::shape_impl() const noexcept -> const inner_shape_type & { return m_shape; } template <class EC, layout_type L, class SC, class Tag> struct xcontainer_inner_types<xarray_container<EC, L, SC, Tag>> { using inner_shape_type = SC; }; template <class, layout_type L, class, class> struct xarray_container : xstrided_container<xarray_container<double, L, svector>> {}; struct xview { template <class CTA, class FSL> xview(CTA, FSL); }; template <class E, class... S> void make_view_impl(E e, S &&...slices) { xview(get_slice_implementation(e, std::forward(slices))...); } template <class E, class... S> void view(E e, S... slices) { make_view_impl(e, slices...); } void TestBody() { xarray<double> a, arr; xrange_adaptor __trans_tmp_3 = range(1, 4), __trans_tmp_4 = range(1, 3); view(a, 1, __trans_tmp_3); view(arr, 1, __trans_tmp_4); } Created attachment 54122 [details]
unreduced test case
I've attached another testcase:
-O2 and -march with AVX support are essential to trigger it:
moya ~ # g++ -c ipa-param-manipulation.i -O1 -march=core-avx-i
moya ~ # g++ -c ipa-param-manipulation.i -O3 -march=core-avx-i
moya ~ # g++ -c ipa-param-manipulation.i -O2 -march=core-avx-i
during IPA pass: inline
In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/tuple:41,
from /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/unique_ptr.h:36,
from /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/memory:78,
from src/mongo/util/background.h:32,
from src/mongo/util/background.cpp:34:
In function 'constexpr _Res std::__invoke_impl(__invoke_other, _Fn&&, _Args&& ...) [with _Res = void; _Fn = mongo::logv2::detail::doLog<mongo::{anonymous}::PeriodicTaskRunner::_runTask(mongo::PeriodicTask*)::<lambda()>::FMT_COMPILE_STRING, 14, NamedArg<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>, NamedArg<mongo::Duration<std::ratio<1, 1000> > > >(int32_t, const mongo::logv2::LogSeverity&, const mongo::logv2::LogOptions&, const mongo::{anonymous}::PeriodicTaskRunner::_runTask(mongo::PeriodicTask*)::<lambda()>::FMT_COMPILE_STRING&, const char (&)[14], const NamedArg<const std::__cxx11::basic_string<char>&>&, const NamedArg<mongo::Duration<std::ratio<1, 1000> > >&)::<lambda(auto:20&& ...)>; _Args = {const mongo::logv2::detail::NamedArg<const __cxx11::basic_string<char, char_traits<char>, allocator<char> >&>&, const mongo::logv2::detail::NamedArg<mongo::Duration<ratio<1, 1000> > >&}]',
inlined from 'constexpr typename std::__invoke_result<_Functor, _ArgTypes>::type std::__invoke(_Callable&&, _Args&& ...) [with _Callable = mongo::logv2::detail::doLog<mongo::{anonymous}::PeriodicTaskRunner::_runTask(mongo::PeriodicTask*)::<lambda()>::FMT_COMPILE_STRING, 14, NamedArg<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>, NamedArg<mongo::Duration<std::ratio<1, 1000> > > >(int32_t, const mongo::logv2::LogSeverity&, const mongo::logv2::LogOptions&, const mongo::{anonymous}::PeriodicTaskRunner::_runTask(mongo::PeriodicTask*)::<lambda()>::FMT_COMPILE_STRING&, const char (&)[14], const NamedArg<const std::__cxx11::basic_string<char>&>&, const NamedArg<mongo::Duration<std::ratio<1, 1000> > >&)::<lambda(auto:20&& ...)>; _Args = {const mongo::logv2::detail::NamedArg<const __cxx11::basic_string<char, char_traits<char>, allocator<char> >&>&, const mongo::logv2::detail::NamedArg<mongo::Duration<ratio<1, 1000> > >&}]' at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/invoke.h:96:40,
inlined from 'constexpr decltype(auto) std::__apply_impl(_Fn&&, _Tuple&&, index_sequence<_Idx ...>) [with _Fn = mongo::logv2::detail::doLog<mongo::{anonymous}::PeriodicTaskRunner::_runTask(mongo::PeriodicTask*)::<lambda()>::FMT_COMPILE_STRING, 14, NamedArg<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>, NamedArg<mongo::Duration<std::ratio<1, 1000> > > >(int32_t, const mongo::logv2::LogSeverity&, const mongo::logv2::LogOptions&, const mongo::{anonymous}::PeriodicTaskRunner::_runTask(mongo::PeriodicTask*)::<lambda()>::FMT_COMPILE_STRING&, const char (&)[14], const NamedArg<const std::__cxx11::basic_string<char>&>&, const NamedArg<mongo::Duration<std::ratio<1, 1000> > >&)::<lambda(auto:20&& ...)>; _Tuple = tuple<const mongo::logv2::detail::NamedArg<const __cxx11::basic_string<char, char_traits<char>, allocator<char> >&>&, const mongo::logv2::detail::NamedArg<mongo::Duration<ratio<1, 1000> > >&>; long unsigned int ..._Idx = {0, 1}]' at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/tuple:2287:27,
inlined from 'constexpr decltype(auto) std::apply(_Fn&&, _Tuple&&) [with _Fn = mongo::logv2::detail::doLog<mongo::{anonymous}::PeriodicTaskRunner::_runTask(mongo::PeriodicTask*)::<lambda()>::FMT_COMPILE_STRING, 14, NamedArg<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>, NamedArg<mongo::Duration<std::ratio<1, 1000> > > >(int32_t, const mongo::logv2::LogSeverity&, const mongo::logv2::LogOptions&, const mongo::{anonymous}::PeriodicTaskRunner::_runTask(mongo::PeriodicTask*)::<lambda()>::FMT_COMPILE_STRING&, const char (&)[14], const NamedArg<const std::__cxx11::basic_string<char>&>&, const NamedArg<mongo::Duration<std::ratio<1, 1000> > >&)::<lambda(auto:20&& ...)>; _Tuple = tuple<const mongo::logv2::detail::NamedArg<const __cxx11::basic_string<char, char_traits<char>, allocator<char> >&>&, const mongo::logv2::detail::NamedArg<mongo::Duration<ratio<1, 1000> > >&>]' at /usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/tuple:2298:31,
inlined from 'void mongo::logv2::detail::doLog(int32_t, const mongo::logv2::LogSeverity&, const mongo::logv2::LogOptions&, const S&, const char (&)[N], const Args& ...) [with S = mongo::{anonymous}::PeriodicTaskRunner::_runTask(mongo::PeriodicTask*)::<lambda()>::FMT_COMPILE_STRING; long unsigned int N = 14; Args = {NamedArg<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&>, NamedArg<mongo::Duration<std::ratio<1, 1000> > >}]' at src/mongo/logv2/log_detail.h:121:15,
inlined from 'void mongo::{anonymous}::PeriodicTaskRunner::_runTask(mongo::PeriodicTask*)' at src/mongo/util/background.cpp:358:440:
/usr/lib/gcc/x86_64-pc-linux-gnu/13/include/g++-v13/bits/invoke.h:61:36: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700
61 | { return std::forward<_Fn>(__f)(std::forward<_Args>(__args)...); }
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x1ced1ad internal_error(char const*, ...)
???:0
0x6be47f fancy_abort(char const*, int, char const*)
???:0
0x9bfc8e cgraph_edge::redirect_call_stmt_to_callee(cgraph_edge*)
???:0
0xe54a9b redirect_all_calls(copy_body_data*, basic_block_def*)
???:0
0xe601bb optimize_inline_calls(tree_node*)
???:0
0xbbd42b inline_transform(cgraph_node*)
???:0
0xd125df execute_all_ipa_transforms(bool)
???:0
0x9c640f cgraph_node::expand()
???:0
0x9c9f77 symbol_table::finalize_compilation_unit()
???:0
In Fedora test mass rebuild this seems to be the most common ICE: ./UNCONFIRMED/fedora-rawhide-ppc64le/llvm8.0/05172811-llvm8.0/build.log.gz /usr/include/c++/13/bits/stl_algo.h:4103:29: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-ppc64le/chatterino2/05168380-chatterino2/build.log.gz /usr/include/c++/13/bits/stl_iterator_base_funcs.h:106:21: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-ppc64le/pdns-recursor/05174194-pdns-recursor/build.log.gz /usr/include/boost/circular_buffer/base.hpp:2824:46: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-ppc64le/krita/05171764-krita/build.log.gz /usr/include/boost/range/iterator_range_core.hpp:408:28: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-ppc64le/root/05185147-root/build.log.gz /usr/include/c++/13/bits/stl_algo.h:4103:29: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-ppc64le/python-graph-tool/05175233-python-graph-tool/build.log.gz src/graph/generation/graph_rewiring.hh:106:5: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-ppc64le/pcl/05174165-pcl/build.log.gz /usr/include/boost/circular_buffer/base.hpp:1787:46: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-ppc64le/innoextract/05171222-innoextract/build.log.gz /usr/include/boost/preprocessor/iteration/detail/limits/local_256.hpp:22:9: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 /usr/include/boost/preprocessor/iteration/detail/limits/local_256.hpp:22:9: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-ppc64le/QuantLib/05167497-QuantLib/build.log.gz /usr/include/c++/13/bits/stl_iterator_base_funcs.h:106:21: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-ppc64le/llvm9.0/05172812-llvm9.0/build.log.gz /usr/include/c++/13/bits/stl_algo.h:4103:29: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-s390x/llvm8.0/05172811-llvm8.0/build.log.gz /usr/include/c++/13/bits/stl_algo.h:4103:29: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-s390x/chatterino2/05168380-chatterino2/build.log.gz /usr/include/c++/13/bits/stl_iterator_base_funcs.h:106:21: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-s390x/pdns-recursor/05174194-pdns-recursor/build.log.gz /usr/include/boost/circular_buffer/base.hpp:2824:46: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-s390x/krita/05171764-krita/build.log.gz /usr/include/boost/range/iterator_range_core.hpp:408:28: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 /usr/include/boost/range/iterator_range_core.hpp:408:28: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-s390x/root/05185147-root/build.log.gz /usr/include/c++/13/bits/stl_algo.h:4103:29: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-s390x/python-graph-tool/05175233-python-graph-tool/build.log.gz src/graph/generation/graph_rewiring.hh:106:5: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-s390x/pcl/05174165-pcl/build.log.gz /usr/include/boost/circular_buffer/base.hpp:1787:46: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-s390x/innoextract/05171222-innoextract/build.log.gz /usr/include/boost/preprocessor/iteration/detail/limits/local_256.hpp:22:9: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 /usr/include/boost/preprocessor/iteration/detail/limits/local_256.hpp:22:9: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-s390x/QuantLib/05167497-QuantLib/build.log.gz /usr/include/c++/13/bits/stl_iterator_base_funcs.h:106:21: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-s390x/llvm9.0/05172812-llvm9.0/build.log.gz /usr/include/c++/13/bits/stl_algo.h:4103:29: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-i386/krita/05171764-krita/build.log.gz /usr/include/boost/range/iterator_range_core.hpp:408:28: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-i386/vigra/05187153-vigra/build.log.gz /builddir/build/BUILD/vigra-1.11.1/include/vigra/multi_convolution.hxx:552:26: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-i386/pcl/05174165-pcl/build.log.gz /usr/include/boost/circular_buffer/base.hpp:1787:46: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-i386/minetest/05173164-minetest/build.log.gz /builddir/build/BUILD/minetest-5.6.1/src/unittest/test_utilities.cpp:241:32: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 /builddir/build/BUILD/minetest-5.6.1/src/unittest/test_utilities.cpp:241:32: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-i386/QuantLib/05167497-QuantLib/build.log.gz /usr/include/c++/13/bits/stl_iterator_base_funcs.h:106:21: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-x86_64/chatterino2/05168380-chatterino2/build.log.gz /usr/include/c++/13/bits/stl_iterator_base_funcs.h:106:21: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-x86_64/pdns-recursor/05174194-pdns-recursor/build.log.gz /usr/include/boost/circular_buffer/base.hpp:2824:46: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-x86_64/krita/05171764-krita/build.log.gz /usr/include/boost/range/iterator_range_core.hpp:408:28: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-x86_64/vigra/05187153-vigra/build.log.gz /builddir/build/BUILD/vigra-1.11.1/include/vigra/multi_convolution.hxx:552:26: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-x86_64/python-graph-tool/05175233-python-graph-tool/build.log.gz src/graph/generation/graph_rewiring.hh:106:5: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-x86_64/pcl/05174165-pcl/build.log.gz /usr/include/boost/circular_buffer/base.hpp:1787:46: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-x86_64/minetest/05173164-minetest/build.log.gz /builddir/build/BUILD/minetest-5.6.1/src/unittest/test_utilities.cpp:241:32: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 /builddir/build/BUILD/minetest-5.6.1/src/unittest/test_utilities.cpp:241:32: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-x86_64/innoextract/05171222-innoextract/build.log.gz /usr/include/boost/preprocessor/iteration/detail/limits/local_256.hpp:22:9: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 /usr/include/boost/preprocessor/iteration/detail/limits/local_256.hpp:22:9: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 ./UNCONFIRMED/fedora-rawhide-x86_64/QuantLib/05167497-QuantLib/build.log.gz /usr/include/c++/13/bits/stl_iterator_base_funcs.h:106:21: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 Got a similar ICE on minetest-5.6.1. With a bit of manual cleanup reduced down to the following: //$ cat bug.cc void __throw_out_of_range_fmt(...); char *_M_p; struct Trans_NS___cxx11_basic_string { long _M_string_length; long _M_check___pos; Trans_NS___cxx11_basic_string() { long __length = 0; _M_string_length = __length; } long size() { return _M_string_length; } long foo___pos; char foo() { return _M_p[foo___pos]; } int compare() { __throw_out_of_range_fmt(_M_check___pos, _M_string_length); __builtin_trap(); } }; bool str_starts_with(Trans_NS___cxx11_basic_string &str, Trans_NS___cxx11_basic_string prefix) { if (str.size() < prefix.size()) str.compare(); for (; prefix.size();) { char __trans_tmp_2 = prefix.foo(); if (__trans_tmp_2) return false; } __builtin_trap(); } void testStartsWith() { Trans_NS___cxx11_basic_string s1, s2; str_starts_with(s1, s2); } $ g++ -Wall -Wextra -O3 -c bug.cc during IPA pass: inline bug.cc: In function 'void testStartsWith()': bug.cc:28:18: internal compiler error: in modify_call, at ipa-param-manipulation.cc:700 28 | str_starts_with(s1, s2); | ~~~~~~~~~~~~~~~^~~~~~~~ 0x1cbdfd4 diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char const*, __va_list_tag (*) [1], diagnostic_t) ???:0 0x1cbec26 internal_error(char const*, ...) ???:0 0x753df0 fancy_abort(char const*, int, char const*) ???:0 0x723afe ipa_param_adjustments::modify_call(cgraph_edge*, bool) [clone .cold] ???:0 0xa4e735 cgraph_edge::redirect_call_stmt_to_callee(cgraph_edge*) ???:0 0xec8a13 redirect_all_calls(copy_body_data*, basic_block_def*) ???:0 0xece256 copy_body(copy_body_data*, basic_block_def*, basic_block_def*, basic_block_def*) [clone .isra.0] ???:0 0xed1ded expand_call_inline(basic_block_def*, gimple*, copy_body_data*, bitmap_head*) ???:0 0xed3b69 optimize_inline_calls(tree_node*) ???:0 0xc3f753 inline_transform(cgraph_node*) ???:0 0xd8d1ff execute_all_ipa_transforms(bool) ???:0 0xa54b3f cgraph_node::expand() ???:0 0xa5604d symbol_table::compile() [clone .part.0] ???:0 0xa58517 symbol_table::finalize_compilation_unit() ???:0 Sorry for the breakage. The problem is that in ipa_param_body_adjustments::m_replacements, items pertaining to the same base original parameter are no longer necessarily adjacent, which is assumed in ipa_param_body_adjustments::modify_call_stmt. So the following is a stupid quick fix: diff --git a/gcc/ipa-param-manipulation.cc b/gcc/ipa-param-manipulation.cc index a0e4098a3f1..974b0c5eb9f 100644 --- a/gcc/ipa-param-manipulation.cc +++ b/gcc/ipa-param-manipulation.cc @@ -2127,7 +2127,7 @@ ipa_param_body_adjustments::modify_call_stmt (gcall **stmt_p, for (; j < repl_list_len; j++) { if (m_replacements[j].base != base) - break; + continue; if (m_replacements[j].unit_offset < agg_arg_offset) continue; pass_through_split_map pt_map; But I'll try to sort m_replacements instead so that we don't do too many of these linear searches. I have posted the sorting patch to the mailing list: https://gcc.gnu.org/pipermail/gcc-patches/2023-January/609459.html (In reply to Martin Jambor from comment #16) > I have posted the sorting patch to the mailing list: > > https://gcc.gnu.org/pipermail/gcc-patches/2023-January/609459.html I confirm the test fixes original minetest-5.6.1 build failure for me. Thank you! The master branch has been updated by Martin Jambor <jamborm@gcc.gnu.org>: https://gcc.gnu.org/g:c389991432da2bcc335a2b4fb7e502d28a6b3346 commit r13-5090-gc389991432da2bcc335a2b4fb7e502d28a6b3346 Author: Martin Jambor <mjambor@suse.cz> Date: Tue Jan 10 14:18:22 2023 +0100 ipa: Sort ipa_param_body_adjustments::m_replacements (PR 108110) The problem in PR 108110 is that elements describing the same base parameter in ipa_param_body_adjustments::m_replacements are not adjacent to each other, which is something that ipa_param_body_adjustments::modify_call_stmt when it gathers all replacements for a parameter. One option would be to simply always keep looking until the end of the vector (see bugzilla comment 15 for a one-line fix) but the correct thing to do is to keep the elements of the vector sorted and thus make such elements adjacent again. This patch does that and then also modifies the look-ups to take advantage of it. Since the one user of ipa_param_body_adjustments that is not tree-inline.cc, which is OpenMP declare SIMD cloning code, also registers its own replacements and in theory pointers to elements of the m_replacements vector can leak through public method get_expr_replacement, I decided that in those cases it is the responsibility of the user of the class to call the sorting method between the replacement registrations and the first lookup. That is why the patch also adds a line to omp-simd-clone.cc. gcc/ChangeLog: 2023-01-09 Martin Jambor <mjambor@suse.cz> PR ipa/108110 * ipa-param-manipulation.h (ipa_param_body_adjustments): New members sort_replacements, lookup_first_base_replacement and m_sorted_replacements_p. * ipa-param-manipulation.cc: Define INCLUDE_ALGORITHM. (ipa_param_body_adjustments::register_replacement): Set m_sorted_replacements_p to false. (compare_param_body_replacement): New function. (ipa_param_body_adjustments::sort_replacements): Likewise. (ipa_param_body_adjustments::common_initialization): Call sort_replacements. (ipa_param_body_adjustments::ipa_param_body_adjustments): Initialize m_sorted_replacements_p. (ipa_param_body_adjustments::lookup_replacement_1): Rework to use std::lower_bound. (ipa_param_body_adjustments::lookup_first_base_replacement): New function. (ipa_param_body_adjustments::modify_call_stmt): Use lookup_first_base_replacement. * omp-simd-clone.cc (ipa_simd_modify_function_body): Call adjustments->sort_replacements. gcc/testsuite/ChangeLog: 2023-01-04 Martin Jambor <mjambor@suse.cz> PR ipa/108110 * g++.dg/ipa/pr108110.C: New test. Fixed. |