public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "weiwt.fnst at cn dot fujitsu.com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/96810] This is a case that gcc shoud not compile successfully, but gcc acts opposite. Date: Mon, 31 Aug 2020 08:28:44 +0000 [thread overview] Message-ID: <bug-96810-4-o339OUoRYR@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-96810-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96810 --- Comment #4 from Wei Wentao <weiwt.fnst at cn dot fujitsu.com> --- >>--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- >>Actually sorry, the diagnostics clang emits is not about the bug mentioned in >>the testcase, but about something different. >>And while the bug described in the comment is really hard to diagnose at >>compile time and in most cases impossible, what clang diagnoses is the fact >>that >>the target construct has implicit map(tofrom:A) clause and because the target >>data maps only a small part of it, it mapping in target construct will fail. >>Still, clang implements it incorrectly, it e.g. rejects: >>int A[30]; >>void >>foo (void) >>{ >> #pragma omp target data map (A[0:4]) >> #pragma omp target >> A[2] = 0; >>} >>int >>main () >>{ >> #pragma omp target data map (A) >> foo (); >> return 0; >>} >>or >>void bar (int *, int); >>void >>foo (void) >>{ >> int A[30]; >> bar (A, 0); >> #pragma omp target data map (A[0:4]) >> #pragma omp target >> A[2] = 0; >> bar (A, 1); >>} >>Both are completely valid and e.g. the latter could work just fine at runtime >>if bar performs #pragma omp target enter data (arg1[:30]) for arg2 0 and exit >>data for arg2 non-zero. >>Perhaps a warning might be ok, but it still can have many false positives >>(unless the compiler can prove that the array can't be mapped before the outer >>target data).
next prev parent reply other threads:[~2020-08-31 8:28 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-27 8:11 [Bug c/96810] New: " weiwt.fnst at cn dot fujitsu.com 2020-08-27 8:49 ` [Bug c/96810] " jakub at gcc dot gnu.org 2020-08-28 5:12 ` weiwt.fnst at cn dot fujitsu.com 2020-08-28 14:39 ` jakub at gcc dot gnu.org 2020-08-31 8:28 ` weiwt.fnst at cn dot fujitsu.com [this message] 2020-09-03 5:14 ` weiwt.fnst at cn dot fujitsu.com
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-96810-4-o339OUoRYR@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).