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/100059] New: [OpenMP] wrong code with 'declare target link' and a scalar variable Date: Tue, 13 Apr 2021 08:58:51 +0000 [thread overview] Message-ID: <bug-100059-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100059 Bug ID: 100059 Summary: [OpenMP] wrong code with 'declare target link' and a scalar variable Product: gcc Version: 11.0 Status: UNCONFIRMED Keywords: openmp, wrong-code 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: --- Target: nvptx-none Created attachment 50578 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50578&action=edit Testcase, compile with 'gcc -fopenmp' with an (nvptx) offloading enabled compiler The attached testcase has four global vars: int a[N], b[N], c[N]; int i = 0; which are used with: #pragma omp declare target link(a,c,b,i) and #pragma omp target map(to: i) map(tofrom: a, b, c) update(); After the call, the one array is not updated but has the previous host value: * For 'declare target link(a,c,b,i)': not updated array is 'b' * For 'declare target link(a,b,c,i)': not updated array is 'c' Namely, the testcase shows: i=5: A=5, B=6, C=7 // Original host value i=5: A=6, B=6, C=10 // target call to 'update': 'B' is not updated i=5: A=7, B=8, C=13 // host update, OK Additionally, when using 'for (int i' in 'update': The error only shows up if there is 'i' And it occurs for the item before 'i', namely: link(a,c,b,i) → 'b' is wrong link(a,c,i,b) → 'c' is wrong The issue occurs with nvptx. It works without offloading and I think it works with GCN (did not show up in the test logs, but I have not manually verified).
next reply other threads:[~2021-04-13 8:58 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-13 8:58 burnus at gcc dot gnu.org [this message] 2021-04-13 13:16 ` [Bug middle-end/100059] " burnus at gcc dot gnu.org 2021-04-13 13:37 ` burnus at gcc dot gnu.org 2021-04-13 14:11 ` burnus at gcc dot gnu.org 2021-04-13 16:39 ` burnus at gcc dot gnu.org 2022-03-29 10:23 ` burnus at gcc dot gnu.org 2023-09-04 9:37 ` tschwinge at gcc dot gnu.org 2023-09-04 12:57 ` [Bug other/100059] " tschwinge 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-100059-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).