From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4F7C13857835; Tue, 9 May 2023 14:10:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4F7C13857835 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683641410; bh=euJ6FQvK2E5avFfHGGsMzd7g5+V7SsbmCxEn/K290jM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=I+9V3cCFzNtiLjK9wUZnRfXzvHurcVleG9xXDcAIGiTBfXOSM0ExoYvho5F3FixEO vvpatIOUT7hckMCc+zBcw0q/E5nT7nYRwW+9XwjPcnYnUyyQuWOmjfb0VHdKeLr8bp Czt6E4RpMF8q95f3TpIOMyUWXjGKi9eOUYSEAVmM= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109756] "internal compiler error: tree check" when using the [[assume]] attribute with pack expansion Date: Tue, 09 May 2023 14:10:10 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: ice-checking, ice-on-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109756 --- Comment #9 from CVS Commits --- The releases/gcc-13 branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:7bd9a34e9fce0fc307ec26d6db071fe0bc02cd37 commit r13-7312-g7bd9a34e9fce0fc307ec26d6db071fe0bc02cd37 Author: Jakub Jelinek Date: Tue May 9 16:05:22 2023 +0200 c++: Reject pack expansion of assume attribute [PR109756] http://eel.is/c++draft/dcl.attr#grammar-4 says "In an attribute-list, an ellipsis may appear only if that attribute's specification permits it." and doesn't explicitly permit it on any standard attribute. The https://wg21.link/p1774r8 paper which introduced assume attribute s= ays "We could therefore hypothetically permit the assume attribute to direc= tly support pack expansion: template void f() { [[assume(args >=3D 0)...]]; } However, we do not propose this. It would require substantial additional work for a very rare use case. Note that this can instead be expressed with a fold expression, which is equivalent to the above and works out of the box without any extra effort: template void f() { [[assume(((args >=3D 0) && ...))]]; } ", but as the testcase shows, GCC 13+ ICEs on assume attribute followed= by ... if it contains packs. The following patch rejects those instead of ICE and for C++17 or later suggests using fold expressions instead (it doesn't make sense to sugge= st it for C++14 and earlier when we'd error on the fold expressions). 2023-05-09 Jakub Jelinek PR c++/109756 * cp-gimplify.cc (process_stmt_assume_attribute): Diagnose pack expansion of assume attribute. * g++.dg/cpp23/attr-assume11.C: New test. (cherry picked from commit 2499540e9abb55079b5f7b7ccdac97fbc63d9ab4)=