From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8992F383D82E; Tue, 31 May 2022 23:23:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8992F383D82E From: "northon_patrick3 at yahoo dot ca" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105797] New: Internal compiler error: Segmentation fault ( fn_type_unification -> satisfaction_cache::satisfaction_cache -> iterative_hash_template_arg ) Date: Tue, 31 May 2022 23:23:21 +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.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: northon_patrick3 at yahoo dot ca 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 attachments.created 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2022 23:23:21 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105797 Bug ID: 105797 Summary: Internal compiler error: Segmentation fault ( fn_type_unification -> satisfaction_cache::satisfaction_cache -> iterative_hash_template_arg ) Product: gcc Version: 12.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: northon_patrick3 at yahoo dot ca Target Milestone: --- Created attachment 53061 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D53061&action=3Dedit Result from -freport-bug The code: ``` #include #include template struct AStruct { using value_type =3D T_; }; template constexpr auto fc1(AStruct v) requires std::integral::value_ty= pe> //requires std::integral { return v; } template constexpr auto fc2(AStruct v1, AStruct v2) requires std::integral::value_t= ype> { return v1; } void test(AStruct v1, AStruct v2) { fc2(v1, v2); } void test2(AStruct v) { fc1(v); } ``` The command line: ``` g++ -std=3Dc++20 test.cpp ``` The error: ``` test.cpp: In substitution of =E2=80=98template constexpr auto fc1(AStruct) requires integral::type::value_type> [with T_ =3D int]=E2=80=99: test.cpp:25:7: required from here test.cpp:25:14: internal compiler error: Segmentation fault 25 | { fc1(v); } | ~~~^~~ 0x1ac4724 internal_error(char const*, ...) ???:0 0x7f1693 iterative_hash_template_arg(tree_node*, unsigned int) ???:0 0x6bf9da satisfaction_cache::satisfaction_cache(tree_node*, tree_node*, sat_info) ???:0 0x81bbd4 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node* const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bo= ol, bool) ???:0 0x69d051 build_new_function_call(tree_node*, vec**, int) ???:0 0x836c31 finish_call_expr(tree_node*, vec**, b= ool, bool, int) ???:0 0x7eaa63 c_parse_file() ???:0 0x914adb c_common_parse_file() ???:0 ``` It happens from GCC 11.1 and onward to GCC 13 at commit 271072ca259dd285e7723d9bf6da7295e4090dfa. GCC is configured with: ``` configure --prefix=3D/opt/pat-gcc --libdir=3D/opt/pat-gcc/lib --libexecdir=3D/opt/pat-gcc/lib --enable-languages=3Dc,c++,lto --with-isl --with-linker-hash-style=3Dgnu --with-system-zlib --enable-__cxa_atexit --enable-cet=3Dauto --enable-checking=3Drelease --enable-clocale=3Dgnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-install-libiberty --enable-linker-build= -id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=3Dposix --disable-libssp --disable-libstdcxx-pch --disable-libunwind-exceptions --disable-werror gdc_include_dir=3D/opt/pat-gcc/include/dlang/gdc ``` If I comment out either one of test or test2 functions, it compiles. If I change either one of the requires clause to use T_ or T1_ instead of declty= pe, it compiles. If I change either one of fc1 or fc2 to use auto instead of a template<> clause, it compiles. So it seem to crash at a very specific condition.=