Bug 98790 - [10/11 Regression] ICE in append_to_statement_list_1 (Segmentation Fault)
Summary: [10/11 Regression] ICE in append_to_statement_list_1 (Segmentation Fault)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: other (show other bugs)
Version: 11.0
: P2 normal
Target Milestone: 10.3
Assignee: Marek Polacek
URL:
Keywords: ice-on-valid-code, needs-bisection
Depends on:
Blocks:
 
Reported: 2021-01-22 10:47 UTC by Matthias Klose
Modified: 2022-07-31 14:43 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 10.2.0
Known to fail: 10.2.1
Last reconfirmed: 2021-01-22 00:00:00


Attachments
preprocessed source, unreduced (354.82 KB, application/x-xz)
2021-01-22 10:47 UTC, Matthias Klose
Details
reduced test case (3.33 KB, text/plain)
2021-01-22 10:50 UTC, Matthias Klose
Details
another reduced test case (1.05 KB, text/plain)
2021-01-22 10:52 UTC, Matthias Klose
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2021-01-22 10:47:48 UTC
Created attachment 50030 [details]
preprocessed source, unreduced

[forwarded from https://bugs.debian.org/980429 and https://bugs.debian.org/980629]

seen with gcc-10 branch 20210110 and also with 20210121. Note I only see the ICE with one out of five calls.

Seen building the nheko package, using PCH by default. But also seen after building without PCH.

Fails with g++ -g -O2 -fstack-protector-strong -Wall -fsized-deallocation -std=c++17 -fPIC -std=gnu++17 -c SnackBar.ii
Comment 1 Matthias Klose 2021-01-22 10:50:31 UTC
Created attachment 50031 [details]
reduced test case

the reduction from https://bugs.debian.org/980429
$ x86_64-linux-gnu-g++-10 -std=c++17 -Wno-return-type -c gcc-10-segfault.C
gcc-10-segfault.C: In substitution of 'template<class _Functor, class, class> std::function<float(float, float, float)>::function(_Functor) [with _Functor = <missing>; <template-parameter-1-2> = <missing>; <template-parameter-1-3> = <missing>]':
gcc-10-segfault.C:283:12:   required from 'static void tweeny::detail::easingresolve<I, TypeTuple, FunctionTuple, tweeny::easing::linearEasing, Fs ...>::impl(FunctionTuple&, tweeny::easing::linearEasing, Fs ...) [with int I = 0; TypeTuple = std::array<float, 1>; FunctionTuple = std::tuple<std::function<float(float, float, float)> >; Fs = {}]'
gcc-10-segfault.C:289:64:   required from 'void tweeny::detail::easingfill(EasingCollectionT&, EasingT, tweeny::detail::int2type<0>) [with TypeTupleT = std::array<float, 1>; EasingCollectionT = std::tuple<std::function<float(float, float, float)> >; EasingT = tweeny::easing::linearEasing]'
gcc-10-segfault.C:297:41:   required from 'void tweeny::detail::tweenpoint<Ts>::via(F) [with F = tweeny::easing::linearEasing; Ts = {float}]'
gcc-10-segfault.C:294:5:   required from 'tweeny::detail::tweenpoint<Ts>::tweenpoint(Ts ...) [with Ts = {float}]'
gcc-10-segfault.C:141:2:   required from 'static constexpr std::_Require<std::__and_<std::__not_<typename std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::type>, std::is_constructible<_Tp, _Args ...> > > std::allocator_traits<_Alloc>::_S_construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = tweeny::detail::tweenpoint<float>; _Args = {float&}; _Alloc = std::allocator<tweeny::detail::tweenpoint<float> >; std::_Require<std::__and_<std::__not_<typename std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::type>, std::is_constructible<_Tp, _Args ...> > > = void; typename std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::type = std::integral_constant<bool, false>]'
gcc-10-segfault.C:144:14:   required from 'static decltype (std::allocator_traits<_Alloc>::_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits<_Alloc>::construct::__args)...)) std::allocator_traits<_Alloc>::construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = tweeny::detail::tweenpoint<float>; _Args = {float&}; _Alloc = std::allocator<tweeny::detail::tweenpoint<float> >; decltype (std::allocator_traits<_Alloc>::_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits<_Alloc>::construct::__args)...)) = void]'
gcc-10-segfault.C:224:26:   required from 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {float&}; _Tp = tweeny::detail::tweenpoint<float>; _Alloc = std::allocator<tweeny::detail::tweenpoint<float> >; std::vector<_Tp, _Alloc>::reference = tweeny::detail::tweenpoint<float>&]'
gcc-10-segfault.C:310:21:   required from 'tweeny::tween<T>& tweeny::tween<T>::to(T) [with T = float]'
gcc-10-segfault.C:322:47:   required from here
gcc-10-segfault.C:283:12: internal compiler error: Segmentation fault
  283 |  get<I>(b) = easing::linear.run<ArgType>;
      |  ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0xa65400 crash_signal
        ../../src/gcc/toplev.c:328
0x7fa8b7dfed5f ???
        ./signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0x13a54ed synthesize_method(tree_node*)
        ../../src/gcc/cp/method.c:1536
0x64cece maybe_instantiate_noexcept(tree_node*, int)
        ../../src/gcc/cp/pt.c:25338
0x768644 resolve_overloaded_unification
        ../../src/gcc/cp/pt.c:22255
0x768644 unify_one_argument
        ../../src/gcc/cp/pt.c:21801
0x111d442 type_unification_real
        ../../src/gcc/cp/pt.c:21945
0x111c93f fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node* const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool, bool)
        ../../src/gcc/cp/pt.c:21325
0x111c02a add_template_candidate_real(z_candidate**, tree_node*, tree_node*, tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed> const*, tree_node*, tree_node*, tree_node*, int, tree_node*, unification_kind_t, int) [clone .isra.0]
        ../../src/gcc/cp/call.c:3417
0xf538cd add_template_candidate
        ../../src/gcc/cp/call.c:3502
0xf538cd add_candidates
        ../../src/gcc/cp/call.c:5855
0x11289ec build_user_type_conversion_1
        ../../src/gcc/cp/call.c:4055
0xedc654 implicit_conversion
        ../../src/gcc/cp/call.c:2075
0x101b193 reference_binding
        ../../src/gcc/cp/call.c:1914
0xedc597 implicit_conversion
        ../../src/gcc/cp/call.c:2013
0xf5424d add_function_candidate
        ../../src/gcc/cp/call.c:2410
0xf53969 add_candidates
        ../../src/gcc/cp/call.c:5868
0x1045831 add_operator_candidates
        ../../src/gcc/cp/call.c:5974
0xf5de70 build_new_op_1
        ../../src/gcc/cp/call.c:6182
0xf5d597 build_new_op(op_location_t const&, tree_code, int, tree_node*, tree_node*, tree_node*, tree_node**, int)
        ../../src/gcc/cp/call.c:6573
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.
The bug is not reproducible, so it is likely a hardware or OS problem.
Comment 2 Matthias Klose 2021-01-22 10:52:32 UTC
Created attachment 50032 [details]
another reduced test case

another reduced test case (this seems to be wrong code)
Comment 3 Matthias Klose 2021-01-22 11:07:05 UTC
https://bugs.debian.org/980629 points to similar issue reported at
https://bugzilla.redhat.com/show_bug.cgi?id=1918341 for the trunk
Comment 4 Richard Biener 2021-01-22 11:23:57 UTC
What GCC 10 version was working?
Comment 5 Matthias Klose 2021-01-22 11:37:59 UTC
the last archive test rebuild from 2020/12/26 didn't show this, using gcc-10 20201224
Comment 6 Martin Liška 2021-01-22 12:27:52 UTC
I think it's fixed with r11-6804-g2b27f37f90cb66e2.
Comment 7 Martin Liška 2021-01-22 12:44:00 UTC
(In reply to Martin Liška from comment #6)
> I think it's fixed with r11-6804-g2b27f37f90cb66e2.

But it fails on gcc-10 branch since g:ff22b4e8d0613170601d28eec9462ea31147c7c7.
@Marek: Can you please take a look?
Comment 8 Matthias Klose 2021-01-22 12:51:40 UTC
I tried to apply the trunk fix for PR98659 on the gcc-10 branch, but it still shows an ICE.
Comment 9 Matthias Klose 2021-01-22 13:29:19 UTC
however reverting the fix for PR82099 lets the build succeed again.

it also fixes the mkvtoolnix build (https://bugs.debian.org/PR980596).
Comment 10 GCC Commits 2021-01-22 17:56:18 UTC
The releases/gcc-10 branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:c806314b32987096d79de21e72dc0cf783e51d57

commit r10-9288-gc806314b32987096d79de21e72dc0cf783e51d57
Author: Marek Polacek <polacek@redhat.com>
Date:   Fri Jan 22 12:50:53 2021 -0500

    c++: Crash when deducing template arguments [PR98790]
    
    maybe_instantiate_noexcept doesn't expect to see error_mark_node, but
    the new callsite I introduced in r11-6476 can pass error_mark_node to
    it.  So cope.
    
    gcc/cp/ChangeLog:
    
            PR c++/98790
            * pt.c (maybe_instantiate_noexcept): Return false if FN is
            error_mark_node.
    
    gcc/testsuite/ChangeLog:
    
            PR c++/98790
            * g++.dg/template/deduce8.C: New test.
Comment 11 Marek Polacek 2021-01-22 17:57:41 UTC
The original unreduced test now compiles with gcc10 & 11.
Comment 12 Eric Gallager 2022-07-31 14:43:40 UTC
Hearing that this may still happen: https://forums.wesnoth.org/viewtopic.php?p=675418#p675418
(haven't tested myself)