From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1F4143851C1C; Fri, 2 Jul 2021 18:07:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F4143851C1C From: "enolan at alumni dot cmu.edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/101303] New: ICE from modified lambda-generic-100362.C test case from bug 100362 Date: Fri, 02 Jul 2021 18:07:15 +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.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: enolan at alumni dot cmu.edu 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 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: Fri, 02 Jul 2021 18:07:16 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101303 Bug ID: 101303 Summary: ICE from modified lambda-generic-100362.C test case from bug 100362 Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: enolan at alumni dot cmu.edu Target Milestone: --- When I was checking whether the fix for bug 100362 worked, I noticed that although it fixed the minimal test case I provided, the original code from which I'd minified it still crashed GCC. After some diffing I discovered th= at the following slight modification of the gcc test case, lambda-generic-100362.C, still caused an ICE. The cpp file I used is as follows: template struct Qux { struct A { } a_; A f(); void AsyncOp() { [this](auto) { using Foo =3D decltype(a_); struct local : Foo {}; local ptr; }(0); } }; void corge() { Qux qux; qux.AsyncOp(); } The changes from the original test case are that "struct local" inherits wi= th a "using" declaration instead of inheriting from "decltype(a_)" directly, and that the lambda captures "this". Although the version details included below are from a build of gcc from the latest master, I also tested this with GCC 9.3.0, and it ICEd that version = as well. > the exact version of GCC I used Spack to build GCC from commit hash 58b735. (I accidentally tagged it "11.1.0.58b735" even though it's 12.0.0.) gcc version 12.0.0 20210701 (experimental) (Spack GCC) > the system type Ubuntu 21.04 > the options given when GCC was configured/built Configured with: /tmp/enolan/spack-stage/spack-stage-gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa= 6cpavixfdwb/spack-src/configure --prefix=3D/home/enolan/spack/opt/spack/linux-ubuntu21.04-zen3/gcc-11.0.1/g= cc-11.1.0.58b735-lfokficgbii3qo3wxptqa6cpavixfdwb --with-pkgversion=3D'Spack GCC' --with-bugurl=3Dhttps://github.com/spack/spack/issues --disable-multilib --enable-languages=3Dc,c++,fortran --disable-nls --with-system-zlib --with-zstd-include=3D/home/enolan/spack/opt/spack/linux-ubuntu21.04-zen3/g= cc-11.0.1/zstd-1.4.9-g5e5ekytpmwt4p2s2whwo5n23uezvaau/include --with-zstd-lib=3D/home/enolan/spack/opt/spack/linux-ubuntu21.04-zen3/gcc-1= 1.0.1/zstd-1.4.9-g5e5ekytpmwt4p2s2whwo5n23uezvaau/lib --with-mpfr-include=3D/home/enolan/spack/opt/spack/linux-ubuntu21.04-zen3/g= cc-11.0.1/mpfr-4.1.0-wkdcn7axxshpddf24rlmrgbnl4b5x4uj/include --with-mpfr-lib=3D/home/enolan/spack/opt/spack/linux-ubuntu21.04-zen3/gcc-1= 1.0.1/mpfr-4.1.0-wkdcn7axxshpddf24rlmrgbnl4b5x4uj/lib --with-gmp-include=3D/home/enolan/spack/opt/spack/linux-ubuntu21.04-zen3/gc= c-11.0.1/gmp-6.2.1-y5nxi6djabr65jjm4pquijfju46tioyl/include --with-gmp-lib=3D/home/enolan/spack/opt/spack/linux-ubuntu21.04-zen3/gcc-11= .0.1/gmp-6.2.1-y5nxi6djabr65jjm4pquijfju46tioyl/lib --with-mpc-include=3D/home/enolan/spack/opt/spack/linux-ubuntu21.04-zen3/gc= c-11.0.1/mpc-1.1.0-v6jniwtyay66af7sk43c75njjrsoyjns/include --with-mpc-lib=3D/home/enolan/spack/opt/spack/linux-ubuntu21.04-zen3/gcc-11= .0.1/mpc-1.1.0-v6jniwtyay66af7sk43c75njjrsoyjns/lib --without-isl --with-stage1-ldflags=3D'-Wl,-rpath,/home/enolan/spack/opt/spack/linux-ubun= tu21.04-zen3/gcc-11.0.1/gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa6cpavixfdwb/= lib -Wl,-rpath,/home/enolan/spack/opt/spack/linux-ubuntu21.04-zen3/gcc-11.0.1/g= cc-11.1.0.58b735-lfokficgbii3qo3wxptqa6cpavixfdwb/lib64 -Wl,-rpath,/home/enolan/spack/opt/spack/linux-ubuntu21.04-zen3/gcc-11.0.1/g= mp-6.2.1-y5nxi6djabr65jjm4pquijfju46tioyl/lib -Wl,-rpath,/home/enolan/spack/opt/spack/linux-ubuntu21.04-zen3/gcc-11.0.1/m= pfr-4.1.0-wkdcn7axxshpddf24rlmrgbnl4b5x4uj/lib -Wl,-rpath,/home/enolan/spack/opt/spack/linux-ubuntu21.04-zen3/gcc-11.0.1/m= pc-1.1.0-v6jniwtyay66af7sk43c75njjrsoyjns/lib -Wl,-rpath,/home/enolan/spack/opt/spack/linux-ubuntu21.04-zen3/gcc-11.0.1/z= lib-1.2.11-xfc275gqwmrd3cwbjnqbnqx2u5gz444l/lib -Wl,-rpath,/home/enolan/spack/opt/spack/linux-ubuntu21.04-zen3/gcc-11.0.1/z= std-1.4.9-g5e5ekytpmwt4p2s2whwo5n23uezvaau/lib' --with-boot-ldflags=3D'-Wl,-rpath,/home/enolan/spack/opt/spack/linux-ubuntu= 21.04-zen3/gcc-11.0.1/gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa6cpavixfdwb/lib -Wl,-rpath,/home/enolan/spack/opt/spack/linux-ubuntu21.04-zen3/gcc-11.0.1/g= cc-11.1.0.58b735-lfokficgbii3qo3wxptqa6cpavixfdwb/lib64 -Wl,-rpath,/home/enolan/spack/opt/spack/linux-ubuntu21.04-zen3/gcc-11.0.1/g= mp-6.2.1-y5nxi6djabr65jjm4pquijfju46tioyl/lib -Wl,-rpath,/home/enolan/spack/opt/spack/linux-ubuntu21.04-zen3/gcc-11.0.1/m= pfr-4.1.0-wkdcn7axxshpddf24rlmrgbnl4b5x4uj/lib -Wl,-rpath,/home/enolan/spack/opt/spack/linux-ubuntu21.04-zen3/gcc-11.0.1/m= pc-1.1.0-v6jniwtyay66af7sk43c75njjrsoyjns/lib -Wl,-rpath,/home/enolan/spack/opt/spack/linux-ubuntu21.04-zen3/gcc-11.0.1/z= lib-1.2.11-xfc275gqwmrd3cwbjnqbnqx2u5gz444l/lib -Wl,-rpath,/home/enolan/spack/opt/spack/linux-ubuntu21.04-zen3/gcc-11.0.1/z= std-1.4.9-g5e5ekytpmwt4p2s2whwo5n23uezvaau/lib -static-libstdc++ -static-libgcc' > the complete command line that triggers the bug g++ -v -save-temps -std=3Dc++17 -c ./ice.cpp > the compiler output (error messages, warnings, etc.) ./ice.cpp: In instantiation of 'struct Qux::AsyncOp()::::local': ./ice.cpp:10:13: required from 'Qux::AsyncOp():: [wi= th auto:1 =3D int]' ./ice.cpp:11:6: required from 'void Qux< >::AsyncOp() [with =3D int]' ./ice.cpp:17:14: required from here ./ice.cpp:7:16: internal compiler error: in lookup_template_class_1, at cp/pt.c:10005 7 | [this](auto) { | ^ 0x6e97ee lookup_template_class_1 =20=20=20=20=20=20=20 /tmp/enolan/spack-stage/spack-stage-gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa= 6cpavixfdwb/spack-src/gcc/cp/pt.c:10005 0xb00806 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_nod= e*, int, int) =20=20=20=20=20=20=20 /tmp/enolan/spack-stage/spack-stage-gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa= 6cpavixfdwb/spack-src/gcc/cp/pt.c:10244 0xb00806 tsubst_aggr_type =20=20=20=20=20=20=20 /tmp/enolan/spack-stage/spack-stage-gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa= 6cpavixfdwb/spack-src/gcc/cp/pt.c:13609 0xaf455c tsubst(tree_node*, tree_node*, int, tree_node*) =20=20=20=20=20=20=20 /tmp/enolan/spack-stage/spack-stage-gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa= 6cpavixfdwb/spack-src/gcc/cp/pt.c:15472 0xadfe1c tsubst_decl =20=20=20=20=20=20=20 /tmp/enolan/spack-stage/spack-stage-gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa= 6cpavixfdwb/spack-src/gcc/cp/pt.c:14481 0xad5a41 tsubst_copy =20=20=20=20=20=20=20 /tmp/enolan/spack-stage/spack-stage-gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa= 6cpavixfdwb/spack-src/gcc/cp/pt.c:16575 0xad7480 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, boo= l, bool) =20=20=20=20=20=20=20 /tmp/enolan/spack-stage/spack-stage-gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa= 6cpavixfdwb/spack-src/gcc/cp/pt.c:20766 0xad7c82 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, boo= l, bool) =20=20=20=20=20=20=20 /tmp/enolan/spack-stage/spack-stage-gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa= 6cpavixfdwb/spack-src/gcc/cp/pt.c:19648 0xad7ec2 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, boo= l, bool) =20=20=20=20=20=20=20 /tmp/enolan/spack-stage/spack-stage-gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa= 6cpavixfdwb/spack-src/gcc/cp/pt.c:20546 0xae2718 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) =20=20=20=20=20=20=20 /tmp/enolan/spack-stage/spack-stage-gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa= 6cpavixfdwb/spack-src/gcc/cp/pt.c:19123 0xae0ad6 tsubst_decl =20=20=20=20=20=20=20 /tmp/enolan/spack-stage/spack-stage-gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa= 6cpavixfdwb/spack-src/gcc/cp/pt.c:14831 0xad645c tsubst_copy =20=20=20=20=20=20=20 /tmp/enolan/spack-stage/spack-stage-gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa= 6cpavixfdwb/spack-src/gcc/cp/pt.c:16710 0xad7480 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, boo= l, bool) =20=20=20=20=20=20=20 /tmp/enolan/spack-stage/spack-stage-gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa= 6cpavixfdwb/spack-src/gcc/cp/pt.c:20766 0xad7c82 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, boo= l, bool) =20=20=20=20=20=20=20 /tmp/enolan/spack-stage/spack-stage-gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa= 6cpavixfdwb/spack-src/gcc/cp/pt.c:19648 0xad7ec2 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, boo= l, bool) =20=20=20=20=20=20=20 /tmp/enolan/spack-stage/spack-stage-gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa= 6cpavixfdwb/spack-src/gcc/cp/pt.c:20546 0xaf4d1e tsubst(tree_node*, tree_node*, int, tree_node*) =20=20=20=20=20=20=20 /tmp/enolan/spack-stage/spack-stage-gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa= 6cpavixfdwb/spack-src/gcc/cp/pt.c:16126 0xb0d132 instantiate_class_template_1 =20=20=20=20=20=20=20 /tmp/enolan/spack-stage/spack-stage-gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa= 6cpavixfdwb/spack-src/gcc/cp/pt.c:11900 0xb0eab2 instantiate_class_template(tree_node*) =20=20=20=20=20=20=20 /tmp/enolan/spack-stage/spack-stage-gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa= 6cpavixfdwb/spack-src/gcc/cp/pt.c:12282 0xb5b109 complete_type(tree_node*) =20=20=20=20=20=20=20 /tmp/enolan/spack-stage/spack-stage-gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa= 6cpavixfdwb/spack-src/gcc/cp/typeck.c:143 0xae0725 tsubst_decl =20=20=20=20=20=20=20 /tmp/enolan/spack-stage/spack-stage-gcc-11.1.0.58b735-lfokficgbii3qo3wxptqa= 6cpavixfdwb/spack-src/gcc/cp/pt.c:14817 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. > the preprocessed file (*.i*) that triggers the bug, generated by adding -= save-temps to the complete compilation command, or, in the case of a bug report for= the GNAT front end, a complete set of source files (see below). # 0 "./ice.cpp" # 0 "" # 0 "" # 1 "/usr/include/stdc-predef.h" 1 3 4 # 0 "" 2 # 1 "./ice.cpp" template struct Qux { struct A { } a_; A f(); void AsyncOp() { [this](auto) { using Foo =3D decltype(a_); struct local : Foo {}; local ptr; }(0); } }; void corge() { Qux qux; qux.AsyncOp(); }=