From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 35C703857C67; Tue, 14 Sep 2021 12:53:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 35C703857C67 From: "pc.wang at linux dot alibaba.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/102326] New: ICE in tree_to_uhwi, at tree.c:4520 Date: Tue, 14 Sep 2021 12:53:14 +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: 10.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pc.wang at linux dot alibaba.com 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, 14 Sep 2021 12:53:14 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102326 Bug ID: 102326 Summary: ICE in tree_to_uhwi, at tree.c:4520 Product: gcc Version: 10.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: pc.wang at linux dot alibaba.com Target Milestone: --- Created attachment 51459 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D51459&action=3Dedit A patch that may fix this bug If there exists static local variable of variable-length vector type(like t= ypes in AARCH64 SVE and RISCV Vector Extension) in C++ template, like: ``` #include template void f() { int i =3D 0; static svbool_t pg =3D svwhilelt_b64(0, N); } int main(int argc, char **argv) { f<2>(); return 0; } ``` GCC raises an ICE like: ``` static-var-in-template.cpp:14:1: internal compiler error: in tree_to_uhwi, = at tree.h:4520 14 | } | ^ ``` And here is the version of GCC: ``` Using built-in specs. COLLECT_GCC=3Daarch64-none-linux-gnu-g++ COLLECT_LTO_WRAPPER=3D/lhome/wangpc/software/arm/bin/../libexec/gcc/aarch64= -none-linux-gnu/10.2.1/lto-wrapper Target: aarch64-none-linux-gnu Configured with: /tmp/dgboter/bbs/build04--cen7x86_64/buildbot/cen7x86_64--aarch64-none-linu= x-gnu/build/src/gcc/configure --target=3Daarch64-none-linux-gnu --prefix=3D --with-sysroot=3D/aarch64-none-linux-gnu/libc --with-build-sysroot=3D/tmp/dgboter/bbs/build04--cen7x86_64/buildbot/cen7x8= 6_64--aarch64-none-linux-gnu/build/build-aarch64-none-linux-gnu/install//aa= rch64-none-linux-gnu/libc --with-bugurl=3Dhttps://bugs.linaro.org/ --enable-gnu-indirect-function --enable-shared --disable-libssp --disable-libmudflap --enable-checking=3Dr= elease --enable-languages=3Dc,c++,fortran --with-gmp=3D/tmp/dgboter/bbs/build04--cen7x86_64/buildbot/cen7x86_64--aarc= h64-none-linux-gnu/build/build-aarch64-none-linux-gnu/host-tools --with-mpfr=3D/tmp/dgboter/bbs/build04--cen7x86_64/buildbot/cen7x86_64--aar= ch64-none-linux-gnu/build/build-aarch64-none-linux-gnu/host-tools --with-mpc=3D/tmp/dgboter/bbs/build04--cen7x86_64/buildbot/cen7x86_64--aarc= h64-none-linux-gnu/build/build-aarch64-none-linux-gnu/host-tools --with-isl=3D/tmp/dgboter/bbs/build04--cen7x86_64/buildbot/cen7x86_64--aarc= h64-none-linux-gnu/build/build-aarch64-none-linux-gnu/host-tools --enable-fix-cortex-a53-843419 --with-pkgversion=3D'GNU Toolchain for the A-profile Architecture 10.2-2020.11 (arm-10.16)' Thread model: posix Supported LTO compression algorithms: zlib gcc version 10.2.1 20201103 (GNU Toolchain for the A-profile Architecture 10.2-2020.11 (arm-10.16))=20 ``` The lack of type checking (defined by hook `TARGET_VERIFY_TYPE_CONTEXT`) af= ter instantiation is the reason, since SVE/RVV types can't be static.=