From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7E3C13858C3A; Wed, 20 Oct 2021 09:43:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7E3C13858C3A From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/102854] New: [OpenMP] Bogus "initializer expression refers to iteration variable" when using templates Date: Wed, 20 Oct 2021 09:43:32 +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: openmp, rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus 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: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter cc 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: Wed, 20 Oct 2021 09:43:32 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102854 Bug ID: 102854 Summary: [OpenMP] Bogus "initializer expression refers to iteration variable" when using templates Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: openmp, rejects-valid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org CC: jakub at gcc dot gnu.org Target Milestone: --- The following code compiles with the "typedef" but fails when used as "template" with: fooc.c:9:3: error: initializer expression refers to iteration variable =E2= =80=98i=E2=80=99 9 | for (IndexType i =3D 0; i < N; ++i) | ^~~ Long version: https://github.com/SOLLVE/sollve_vv/blob/master/tests/5.0/application_kerne= ls/lsms_triangular_packing.cpp [Side note: According to the notes in the Pull Request #225, it works with = LLVM 13 but fails with LLVM 11 and 12.] Reduceted testcase: // typedef IndexType int; // < works: template // < fails void foo (IndexType N, IndexType M) { #pragma omp target teams distribute parallel for collapse(2) for (IndexType i =3D 0; i < N; ++i) for (IndexType k =3D i; k < M; ++k) ; }=