https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97412

            Bug ID: 97412
           Summary: [concepts] ICE with requires requires and parameter
                    packs
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hello at josephloser dot com
  Target Milestone: ---

Created attachment 49367
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49367&action=edit
requires requires with parameter packs bug

The code below causes an internal compiler error/segfault when parsing a
requires requires expression involving parameter packs.

The ICE occurs in GCC 10.2.0 (which was used to produce the attached
preprocessed file), but the issue also occurs on trunk. 

c++-10 -v       
Using built-in specs.
COLLECT_GCC=c++-10
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/10.2.0/libexec/gcc/x86_64-apple-darwin19/10.2.0/lto-wrapper
Target: x86_64-apple-darwin19
Configured with: ../configure --build=x86_64-apple-darwin19
--prefix=/usr/local/Cellar/gcc/10.2.0
--libdir=/usr/local/Cellar/gcc/10.2.0/lib/gcc/10 --disable-nls
--enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran
--program-suffix=-10 --with-gmp=/usr/local/opt/gmp
--with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc
--with-isl=/usr/local/o
pt/isl --with-system-zlib --with-pkgversion='Homebrew GCC 10.2.0'
--with-bugurl=https://github.com/Homebrew/homebrew-core/issues
--disable-multilib --with-native-system-header-dir=/usr/include
--with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
SED=/usr/bin/sed
Thread model: posix
Supported LTO compression algorithms: zlib

Output of compiling the program with -std=c++2a:
prog.cc:8:38: internal compiler error: Segmentation fault
    8 |   requires call_bar_with<T, TArgs...>;
      |                                      ^
0xc310af crash_signal
        ../../source/gcc/toplev.c:330
0x5de480 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
        ../../source/gcc/cp/pt.c:12929
0x7562e1 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        ../../source/gcc/cp/pt.c:13233
0x756768 tsubst_argument_pack(tree_node*, tree_node*, int, tree_node*)
        ../../source/gcc/cp/pt.c:13195
0x7562b4 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        ../../source/gcc/cp/pt.c:13245
0x65d551 normalize_concept_check
        ../../source/gcc/cp/constraint.cc:689
0x65d551 normalize_atom
        ../../source/gcc/cp/constraint.cc:723
0x65d551 normalize_expression
        ../../source/gcc/cp/constraint.cc:752
0x65d894 get_normalized_constraints
        ../../source/gcc/cp/constraint.cc:764
0x65d894 normalize_constraint_expression
        ../../source/gcc/cp/constraint.cc:906
0x65f358 normalize_constraint_expression
        ../../source/gcc/cp/constraint.cc:902
0x65f358 finish_nested_requirement(unsigned int, tree_node*)
        ../../source/gcc/cp/constraint.cc:2997
0x7082dd cp_parser_nested_requirement
        ../../source/gcc/cp/parser.c:28279
0x7082dd cp_parser_requirement
        ../../source/gcc/cp/parser.c:28079
0x7082dd cp_parser_requirement_seq
        ../../source/gcc/cp/parser.c:28050
0x7082dd cp_parser_requirement_body
        ../../source/gcc/cp/parser.c:28030
0x7082dd cp_parser_requires_expression
        ../../source/gcc/cp/parser.c:27976
0x7082dd cp_parser_primary_expression
        ../../source/gcc/cp/parser.c:5644
0x712374 cp_parser_postfix_expression
        ../../source/gcc/cp/parser.c:7328
0x6f5a8a cp_parser_binary_expression
        ../../source/gcc/cp/parser.c:9648
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Wandbox link: https://wandbox.org/permlink/j6GtQTNEFVTgZYW5

Reply via email to