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

            Bug ID: 94128
           Summary: ICE on C++20 "requires requires" with lambda
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bisqwit at iki dot fi
  Target Milestone: ---

For this code:

    void test(auto param)
    requires requires{ { [](auto p){return p;}(param) }; };

    void test2() { test(1); }

On this compiler:

    g++-10 (Debian 10-20200222-1) 10.0.1 20200222 (experimental) [master
revision 01af7e0a0c2:487fe13f218:e99b18cf7101f205bfdd9f0f29ed51caaec52779]

Compiling with this commandline:

    g++-10 -v tmp.cc -std=c++20

We get:

Using built-in specs.
COLLECT_GCC=g++-10
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/10/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 10-20200222-1'
--with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs
--enable-languages=c,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-10
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new
--enable-gnu-unique-object --disable-vtable-verify --enable-plugin
--enable-default-pie --with-system-zlib --with-target-system-zlib=auto
--enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic --enable-offload-targets=nvptx-none,amdgcn-amdhsa,hsa
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.0.1 20200222 (experimental) [master revision
01af7e0a0c2:487fe13f218:e99b18cf7101f205bfdd9f0f29ed51caaec52779] (Debian
10-20200222-1) 
COLLECT_GCC_OPTIONS='-v' '-std=c++2a' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/10/cc1plus -quiet -v -imultiarch
x86_64-linux-gnu -D_GNU_SOURCE tmp.cc -quiet -dumpbase tmp.cc -mtune=generic
-march=x86-64 -auxbase tmp -std=c++2a -version -fasynchronous-unwind-tables -o
/tmp/cc8CWcEJ.s
GNU C++17 (Debian 10-20200222-1) version 10.0.1 20200222 (experimental) [master
revision 01af7e0a0c2:487fe13f218:e99b18cf7101f205bfdd9f0f29ed51caaec52779]
(x86_64-linux-gnu)
        compiled by GNU C version 10.0.1 20200222 (experimental) [master
revision 01af7e0a0c2:487fe13f218:e99b18cf7101f205bfdd9f0f29ed51caaec52779], GMP
version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22-GMP

warning: GMP header version 6.2.0 differs from library version 6.1.2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/10"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/10
 /usr/include/x86_64-linux-gnu/c++/10
 /usr/include/c++/10/backward
 /usr/lib/gcc/x86_64-linux-gnu/10/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/10/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
GNU C++17 (Debian 10-20200222-1) version 10.0.1 20200222 (experimental) [master
revision 01af7e0a0c2:487fe13f218:e99b18cf7101f205bfdd9f0f29ed51caaec52779]
(x86_64-linux-gnu)
        compiled by GNU C version 10.0.1 20200222 (experimental) [master
revision 01af7e0a0c2:487fe13f218:e99b18cf7101f205bfdd9f0f29ed51caaec52779], GMP
version 6.2.0, MPFR version 4.0.2, MPC version 1.1.0, isl version isl-0.22-GMP

warning: GMP header version 6.2.0 differs from library version 6.1.2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: f533434f622c23e753fbd5b6135ebdd3
tmp.cc: In instantiation of ‘void test(auto:1) requires
requires{{(<lambda>)(test::param)};} [with auto:1 = int]’:
tmp.cc:3:22:   required from here
tmp.cc:2:26: internal compiler error: Segmentation fault
    2 |     requires requires{ { [](auto p){return p;}(param) }; };
      |                          ^~~~~~~~~~~~~~~~~~~~~
0xc248ef crash_signal
        ../../src/gcc/toplev.c:328
0x7fb53dd2d0ff ???
       
/build/glibc-kSJANG/glibc-2.29/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0x733be8 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/pt.c:13090
0x738602 tsubst_function_decl
        ../../src/gcc/cp/pt.c:13501
0x738e38 tsubst_template_decl
        ../../src/gcc/cp/pt.c:13894
0x72a95e tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/pt.c:18862
0x72d085 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../src/gcc/cp/pt.c:20304
0x72be2c tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../src/gcc/cp/pt.c:18962
0x72be2c tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../src/gcc/cp/pt.c:19559
0x7250a4 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../src/gcc/cp/pt.c:18962
0x7250a4 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../src/gcc/cp/pt.c:18597
0x648a39 tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/constraint.cc:1866
0x72c7f4 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../src/gcc/cp/pt.c:20336
0x7250a4 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../src/gcc/cp/pt.c:18962
0x7250a4 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../src/gcc/cp/pt.c:18597
0x648082 satisfy_constraint_r
        ../../src/gcc/cp/constraint.cc:2523
0x6487e8 satisfy_constraint
        ../../src/gcc/cp/constraint.cc:2599
0x649184 satisfy_declaration_constraints
        ../../src/gcc/cp/constraint.cc:2617
0x649c68 constraint_satisfaction_value
        ../../src/gcc/cp/constraint.cc:2733
0x649c68 constraints_satisfied_p(tree_node*)
        ../../src/gcc/cp/constraint.cc:2754
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.

Reply via email to