From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 04FA73858D39; Fri, 6 Jan 2023 03:09:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 04FA73858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672974561; bh=Sc0roViGm33buMpGdEcCzSkHNLvH4Yhm12W/rAWovuk=; h=From:To:Subject:Date:From; b=A0GmiTeY3+JCun3QKnXI8qHROxhhJ5cOAZ2cUP0nsOthJji1bJ2p2cZP/QB1IpbG7 dDR/n9+wMfG0EzxEeD9PI5kuv4knLL2RDGo2EEm7jtAFntdrhgcAiiLOUuoQqfrrQC iPTNcjKLVXIDWv+dxndb5Q8yJQSNOaYUxXGILvJU= From: "tim at klingt dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108309] New: ICE in in cxx_eval_component_reference, at cp/constexpr.cc:4136 Date: Fri, 06 Jan 2023 03:09:19 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tim at klingt dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108309 Bug ID: 108309 Summary: ICE in in cxx_eval_component_reference, at cp/constexpr.cc:4136 Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: tim at klingt dot org Target Milestone: --- ``` template constexpr _Tp forward(_Tp &__t) { return static_cast<_Tp &&>(__t); } struct _Enable_copy_move {}; struct optional; template struct __array_traits { typedef optional _Type[_Nm]; }; template struct array { __array_traits<_Nm>::_Type _M_elems; }; struct _Optional_payload_base { union { int _M_value; }; }; struct _Optional_base { constexpr _Optional_base(...) : _M_payload() {} constexpr _Optional_base(_Optional_base &&) {} _Optional_payload_base _M_payload; }; struct optional : _Optional_base, _Enable_copy_move { using _Base =3D _Optional_base; constexpr optional() {} template constexpr optional(_Up __t) : _Base(forward(__t))= {} } page { array<8> {} } ``` gives me: ``` =E2=9E=9C scratch /usr/bin/g++-12 -std=3Dgnu++20 testcase.ii testcase.ii:24:1: in =E2=80=98constexpr=E2=80=99 expansion of =E2=80=98page.optional::optional >(array<8>{__array_traits<8>::_Ty= pe()})=E2=80=99 testcase.ii:24:1: in =E2=80=98constexpr=E2=80=99 expansion of =E2=80=98fo= rward(_Tp&) [with _Tp =3D array<8>]()=E2=80=99 testcase.ii:24:1: in =E2=80=98constexpr=E2=80=99 expansion of =E2=80=98ar= ray<8>((* &((array<8>&&)__t)))=E2=80=99 testcase.ii:24:1: in =E2=80=98constexpr=E2=80=99 expansion of =E2=80=98optional(.array<8>::_M_elems[0])=E2=80=99 testcase.ii:24:1: internal compiler error: in cxx_eval_component_reference,= at cp/constexpr.cc:4136 24 | } | ^ 0x7fb4eb429d8f __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 0x7fb4eb429e3f __libc_start_main_impl ../csu/libc-start.c:392 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See for instructions. ``` with ``` g++-12 (Ubuntu 12.2.0-3ubuntu1~22.04) 12.2.0 Copyright (C) 2022 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ``` unfortunately cvise didn't reduce the test case to valid c++ code (afaict there's only a missing semicolon, though). with a trailing semicolon, gcc-11 accepts the code, but clang++-15 doesn't (not sure if it's related, but i thought it's worth mentioning: ``` testcase.reduced.cc:21:63: error: cannot pass object of non-trivial type 'array<8>' through variadic constructor; call will abort at runtime [-Wnon-pod-varargs] template constexpr optional(_Up __t) : _Base(forward(__t))= {} ^ testcase.reduced.cc:22:3: note: in instantiation of function template specialization 'optional::optional>' requested here } page { ^ 1 error generated. ```=