From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BF7C53858C27; Wed, 27 Oct 2021 07:28:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BF7C53858C27 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/102854] [OpenMP] Bogus "initializer expression refers to iteration variable" when using templates Date: Wed, 27 Oct 2021 07:28:56 +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: 12.0 X-Bugzilla-Keywords: openmp, rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org 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: 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 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: Wed, 27 Oct 2021 07:28:56 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102854 --- Comment #3 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:6b0f35299bd1468ebc13b900a73b7cac6181a2aa commit r12-4732-g6b0f35299bd1468ebc13b900a73b7cac6181a2aa Author: Jakub Jelinek Date: Wed Oct 27 09:16:48 2021 +0200 openmp: Don't reject some valid initializers or conditions of non-rectangular loops [PR102854] In C++, if an iterator has or might have (e.g. dependent type) class ty= pe we remember the original init expressions and check those separately for presence of iterators, because for class iterators we turn those into expressions that always do contain reference to the current iterator. But this resulted= in rejecting valid non-rectangular loop where the dependent type is later instantiated to an integral type. Non-rectangular loops with class random access iterators remain broken, that is something to be fixed incrementally. 2021-10-27 Jakub Jelinek PR c++/102854 gcc/c-family/ * c-common.h (c_omp_check_loop_iv_exprs): Add enum tree_code argument. * c-omp.c (c_omp_check_loop_iv_r): For trees other than decls, TREE_VEC, PLUS_EXPR, MINUS_EXPR, MULT_EXPR, POINTER_PLUS_EXPR or conversions temporarily clear the 3rd bit from d->kind while walking subtrees. (c_omp_check_loop_iv_exprs): Add CODE argument. Or in 4 into data.kind if possibly non-rectangular. gcc/cp/ * semantics.c (handle_omp_for_class_iterator, finish_omp_for): Adjust c_omp_check_loop_iv_exprs caller. gcc/testsuite/ * g++.dg/gomp/loop-3.C: Don't expect some errors. * g++.dg/gomp/loop-7.C: New test.=