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