public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/96810] New: This is a case that gcc shoud not compile successfully, but gcc acts opposite.
@ 2020-08-27  8:11 weiwt.fnst at cn dot fujitsu.com
  2020-08-27  8:49 ` [Bug c/96810] " jakub at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: weiwt.fnst at cn dot fujitsu.com @ 2020-08-27  8:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96810

            Bug ID: 96810
           Summary: This is a case that gcc shoud not compile
                    successfully, but gcc acts opposite.
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: weiwt.fnst at cn dot fujitsu.com
  Target Milestone: ---

In the examples below, gcc has opposite behavior when complie:

These examples are from:
https://www.openmp.org/wp-content/uploads/openmp-examples-5-0-1.pdf

4.5 Array Sections in Device Constructs
Example array_sections.2.c

As the declaration before the example says "This example shows the invalid
usage of two separate sections of the same array inside of a target construct"
and the text annotation in the example says, gcc shoud not compile
successfully.

However, gcc acts opposite when compile, details are as below:

test case:
-------------------------------------------------
Example array_sections.2.c
void foo ()
{
    int A[30], *p;
    #pragma omp target data map( A[0:4] )
  {
    p = &A[0];
    /* invalid because p[3] and A[3] are the same
     * location on the host but the array section
     * specified via p[...] is not a subset of A[0:4] */
    #pragma omp target map( p[3:20] )
    {
    A[2] = 0;
    p[8] = 0;
    }
  }
}

test command:
-------------------------------------------------
#gcc -v
Target: x86_64-pc-linux-gnu
Configured with:./.../configure 
   --prefix=/.../ 
   --with-gmp=/.../gmp-6.1.0/ 
   --with-mpfr=/.../mpfr-3.1.4/ 
   --with-mpc=/.../mpc-1.0.3/ 
   --enable-multilib
Thread model: posix
gcc version 11.0.0 20200519 (experimental) (GCC)

#gcc -fopenmp -I/.../include Example array_sections.2.c

-------------------------------------------------

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-09-03  5:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-27  8:11 [Bug c/96810] New: This is a case that gcc shoud not compile successfully, but gcc acts opposite 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
2020-09-03  5:14 ` weiwt.fnst at cn dot fujitsu.com

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).