From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A08D7387093A; Sat, 16 Dec 2023 00:37:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A08D7387093A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1702687079; bh=fQfL7JODIj/+VbE9VCi8ojKXIczClBZMYH1TVaOb9Ho=; h=From:To:Subject:Date:In-Reply-To:References:From; b=WErSTe0wc4QtRo8ia9usgsyT6a3mSQTLIEDinUArD9UwqwxvfTNMtAvtob47iu6eD wly5iqPH/IcToqFy+HvS/mfvSFHBvZicvrtdGWq/PrKqs00pN0bwyDyUAoNFod7/df PzMgYZKJzOU3duONBFJZrotSmhpguxsMK0eQ1UOA= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/112795] [C++>=14] ICE pragma GCC unroll (n) cxx_eval_constant_expression Date: Sat, 16 Dec 2023 00:37:58 +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: 8.1.0 X-Bugzilla-Keywords: ice-on-valid-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: 11.5 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=3D112795 --- Comment #11 from GCC Commits --- The releases/gcc-12 branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:f1761303c77219281c22ab50b4a9ce65920c4023 commit r12-10051-gf1761303c77219281c22ab50b4a9ce65920c4023 Author: Jakub Jelinek Date: Mon Dec 4 08:59:15 2023 +0100 c++: #pragma GCC unroll C++ fixes [PR112795] foo in the unroll-5.C testcase ICEs because cp_parser_pragma_unroll during parsing calls maybe_constant_value unconditionally, which is fine if !processing_template_decl, but can ICE otherwise. While just calling fold_non_dependent_expr there instead could be enough to fix the ICE (and I guess the right thing to do for backports if any), I don't see a reason why we couldn't handle a dependent #pragma GCC unr= oll argument as well, the unrolling isn't done in the FE and all the middle= -end cares about is that ANNOTATE_EXPR has a 1..65534 last operand when it is annot_expr_unroll_kind. So, the following patch changes all the unsigned short unroll arguments to tree unroll (and thus avoids the tree -> unsigned short -> tree conversions), does the type and value checking during parsing only if the argument isn't dependent and repeats it during instantiation. 2023-12-04 Jakub Jelinek PR c++/112795 gcc/cp/ * parser.cc (cp_parser_pragma_unroll): Use fold_non_dependent_e= xpr instead of maybe_constant_value. gcc/testsuite/ * g++.dg/ext/unroll-5.C: New test. (cherry picked from commit b6c78feea08c36e5754818c6a3d7536b3f8913dc)=