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: Fri, 28 Aug 2020 05:12:36 +0000	[thread overview]
Message-ID: <bug-96810-4-FMDNLtRTPX@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 #2 from Wei Wentao <weiwt.fnst at cn dot fujitsu.com> ---
> --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
> >The standard says this is unspecified behavior, but the unspecified behavior
> >happens at runtime, so if the compiler could detect it at compile time, it
> >would need to be at most a warning (if the code is never called, there is no
> >unspecified behavior).  Generally this isn't something that can be detected at
> >compile time, e.g. the target data can be in a different function from target,
> >or there could be target exit data that unmaps it in between and makes it
> >valid, or the fact that the pointer must alias the array could be not known to
> >the compiler, etc.
> >And the testcase is rejected at runtime:
> >libgomp: Trying to map into device [0x7ffc13463cbc..0x7ffc13463d0c) object when
> > [0x7ffc13463cb0..0x7ffc13463cc0) is already mapped 



When I use clang to compile the same case, the compilation fails which is in
line with expectations and is opposite to the result of gcc. The details show
as below:

clang version 11.0.0

clang /.../llvm/build/bin/clang -fopenmp-version=50 -fopenmp
-I/.../common.deb.ompt.optional/include/ Example array_sections.2.c
Example_array_sections.2.c:19:7: error: original storage of expression in data
environment is shared but data environment do not fully contain mapped
expression storage
      A[2] = 0;
      ^
Example_array_sections.2.c:11:30: note: used here
#pragma omp target data map( A[0:4] )
                             ^~~~~~
1 error generated.

  parent reply	other threads:[~2020-08-28  5:12 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 [this message]
2020-08-28 14:39 ` jakub at gcc dot gnu.org
2020-08-31  8:28 ` weiwt.fnst at cn dot fujitsu.com
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-FMDNLtRTPX@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: link
Be 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).