public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.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 [thread overview] Message-ID: <bug-106504-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106504 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 – and prints at runtime 10 for one thread – 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 <stdio.h> int main() { int i; #pragma omp parallel private (i) { i = 6; #pragma omp for simd for (i = 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." And: "Restrictions to the *lastprivate* clause are as follows: * A list item must not appear in a *lastprivate* clause on a work-distribution construct if the corresponding region binds to the region of a parallelism-generating construct in which the list item is private."
next reply other threads:[~2022-08-02 11:02 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-08-02 11:02 burnus at gcc dot gnu.org [this message] 2022-08-10 7:40 ` [Bug middle-end/106504] " jakub at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-106504-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).