From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A57F83858D35; Fri, 21 Jul 2023 10:34:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A57F83858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689935678; bh=uOhyTDU+aNDBwdpwwO4l+98gR0Ixv2+Y1hmke6aOwto=; h=From:To:Subject:Date:In-Reply-To:References:From; b=m35jTRqEHD4V4pXUZTFRMhPsasrnop289H8ZoYj6gproixWtPIpU0yGfkT3YnfSSr zYcJZNOlLhIYqSzqtSiD+HEnCLF/mu/JpdZIWiUKZ50wjvaHeTmOmoI0P1+h4i+2se wQg7bwZSyqWUVshwUhgtZNlPT5gj4Kv95vLf2pvc= From: "burnus 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: Fri, 21 Jul 2023 10:34:37 +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: burnus at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED 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: resolution bug_status 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=3D102854 Tobias Burnus changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED --- Comment #5 from Tobias Burnus --- Close as FIXED - based on * my previous comment (comment 4) * based on the following: (In reply to Jakub Jelinek from comment #2) > WIP patch. Clearly still more work is needed, apparently pointer iterato= rs > in non-rectangular loops are rejected, like: (example that is committed as part of PR106449) > and enabling it result in ICEs during omp-expand.c. Furthermore, for both > pointer and random access iterator non-rect loops, I think we cannot really use non-rectangular loops with random-access iterators.=20 It works fine as long as the outer and the inner loop access different variables, an example for this is libgomp.c++/collapse-2.C =E2=86=92=20 https://gcc.gnu.org/git/?p=3Dgcc.git;a=3Dblob;f=3Dlibgomp/testsuite/libgomp= .c++/collapse-2.C;hb=3DHEAD But I currently see no way to use in the outer loop * a C++ iterator * a range-based for loop * a C-style index-variable loop and then to use 'outer' in any way, except of having yet another classic C-style loop. Everything else I came up ends up using an expression involving the outer iteration variable and not the bare variable. But that's rejected ("express= ion refers to iteration variable" error). > I should verify we only > allow the var-outer, var-outer + a2, a2 + var-outer and var-outer - a2 fo= rms > and no others and test code generation. I believe that's what r12-4733-g2084b5f42a4432da8b0625f9c669bf690ec46468 do= es in c-c++-common/gomp/loop-9.c =E2=86=92 https://gcc.gnu.org/git/?p=3Dgcc.git;a=3Dblob;f=3Dgcc/testsuite/c-c++-commo= n/gomp/loop-9.c;hb=3DHEAD (Admittedly only for "initializer expression" and not for "condition expression" or "increment expression", but I can confirm that at last the condition error works.)=