From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B38233856DDD; Tue, 2 Aug 2022 11:02:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B38233856DDD From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/106504] New: [OpenMP] 'for simd linear(i:1)' should be rejected with 'parallel private(i)' Date: Tue, 02 Aug 2022 11:02:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: accepts-invalid, diagnostic, openmp 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: Tue, 02 Aug 2022 11:02:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D106504 Bug ID: 106504 Summary: [OpenMP] 'for simd linear(i:1)' should be rejected with 'parallel private(i)' Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: accepts-invalid, diagnostic, openmp Severity: normal Priority: P3 Component: middle-end 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 program is a bit odd =E2=80=93 and prints at runtime 10 for o= ne thread =E2=80=93 and 6 for all others. And I believe it is invalid for the reason given below: Pre-remark: the 'for simd' directive has a predetermined 'linear(i:1)', which can also be explicitly be specified without affecting the program. ------------------------------------ #include int main() { int i; #pragma omp parallel private (i) { i =3D 6; #pragma omp for simd for (i =3D 1; i < 10; i++) ; printf ("%i\n", i); } return 0; } ---------------------------------- I think the following applies: "17.2 Clauses on Combined and Composite Constructs" "If a list item of the linear clause is the iteration variable of a *simd* = or worksharing-loop SIMD construct and it is not declared in the construct, the effect on the outer leaf constructs is as if the list item was specified in= a *lastprivate* clause on the combined or composite construct with the rules specified above applied."=20 And: "Restrictions to the *lastprivate* clause are as follows: * A list item must not appear in a *lastprivate* clause on a work-distribu= tion construct if the corresponding region binds to the region of a parallelism-generating construct in which the list item is private."=