c-parser.c (c_parser_oacc_declare): Don't scan for GOMP_MAP_POINTER.
authorCesar Philippidis <cesar@codesourcery.com>
Fri, 15 Jul 2016 14:13:48 +0000 (07:13 -0700)
committerCesar Philippidis <cesar@gcc.gnu.org>
Fri, 15 Jul 2016 14:13:48 +0000 (07:13 -0700)
gcc/c/
* c-parser.c (c_parser_oacc_declare): Don't scan for
GOMP_MAP_POINTER.
* c-typeck.c (handle_omp_array_sections): Mark data clauses with
GOMP_MAP_FORCE_{PRESENT,TO,FROM,TOFROM} as potentially having
zero-length subarrays.

gcc/cp/
* parser.c (cp_parser_oacc_declare): Don't scan for
GOMP_MAP_POINTER.
* semantics.c (handle_omp_array_sections): Mark data clauses with
GOMP_MAP_FORCE_{PRESENT,TO,FROM,TOFROM} as potentially having
zero-length subarrays.

gcc/
* omp-low.c (lower_omp_target): Mark data clauses with
GOMP_MAP_FORCE_{PRESENT,TO,FROM,TOFROM} as potentially having
zero-length subarrays.

libgomp/
* testsuite/libgomp.oacc-c-c++-common/zero_length_subarrays.c: New
test.

From-SVN: r238376

gcc/ChangeLog
gcc/c/ChangeLog
gcc/c/c-parser.c
gcc/c/c-typeck.c
gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/cp/semantics.c
gcc/omp-low.c
libgomp/ChangeLog
libgomp/testsuite/libgomp.oacc-c-c++-common/zero_length_subarrays.c [new file with mode: 0644]

index 9e393803eb2310468240b1f077fd507d32d968fc..7f7fc13e139de8cba6474017af5b1e151cf47863 100644 (file)
@@ -1,3 +1,9 @@
+2016-07-15  Cesar Philippidis  <cesar@codesourcery.com>
+
+       * omp-low.c (lower_omp_target): Mark data clauses with
+       GOMP_MAP_FORCE_{PRESENT,TO,FROM,TOFROM} as potentially having
+       zero-length subarrays.
+
 2016-07-15  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/71881
index 968d942c7bee9eb084a64ab9b3fa92d8e02d8c53..bc1e9558774ed6b7612a2b6515a6cdd6911cbce2 100644 (file)
@@ -1,3 +1,11 @@
+2016-07-15  Cesar Philippidis  <cesar@codesourcery.com>
+
+       * c-parser.c (c_parser_oacc_declare): Don't scan for
+       GOMP_MAP_POINTER.
+       * c-typeck.c (handle_omp_array_sections): Mark data clauses with
+       GOMP_MAP_FORCE_{PRESENT,TO,FROM,TOFROM} as potentially having
+       zero-length subarrays.
+
 2016-07-15  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/71858
index 8fb4e4dd14f0426268d065598a080825b1f45dec..ef585fb99906160e0ada504fb10540a7156b3584 100644 (file)
@@ -13664,11 +13664,6 @@ c_parser_oacc_declare (c_parser *parser)
        case GOMP_MAP_DEVICE_RESIDENT:
          break;
 
-       case GOMP_MAP_POINTER:
-         /* Generated by c_finish_omp_clauses from array sections;
-            avoid spurious diagnostics.  */
-         break;
-
        case GOMP_MAP_LINK:
          if (!global_bindings_p ()
              && (TREE_STATIC (decl)
index bafd0d23195bb9b2af9629f10d9a0f0857f9f0d1..0b5ab91d0d5f1ee07dcdfbea292244f8f9637906 100644 (file)
@@ -12505,6 +12505,10 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
          case GOMP_MAP_ALWAYS_TOFROM:
          case GOMP_MAP_RELEASE:
          case GOMP_MAP_DELETE:
+         case GOMP_MAP_FORCE_TO:
+         case GOMP_MAP_FORCE_FROM:
+         case GOMP_MAP_FORCE_TOFROM:
+         case GOMP_MAP_FORCE_PRESENT:
            OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION (c) = 1;
            break;
          default:
index f7f7ba3ce34982b25976ae35895e7a51cd000f02..f85a33332812c721b040f5b724ec83a5d4e782b0 100644 (file)
@@ -1,3 +1,11 @@
+2016-07-15  Cesar Philippidis  <cesar@codesourcery.com>
+
+       * parser.c (cp_parser_oacc_declare): Don't scan for
+       GOMP_MAP_POINTER.
+       * semantics.c (handle_omp_array_sections): Mark data clauses with
+       GOMP_MAP_FORCE_{PRESENT,TO,FROM,TOFROM} as potentially having
+       zero-length subarrays.
+
 2016-07-11  Jason Merrill  <jason@redhat.com>
 
        * decl.c (store_parm_decls): Remove check for void parm.
index ef35aa9cfb05bea32683c2812c8cb9f4989ac504..3e865b0fb64557972e447e5f34968c28337566c8 100644 (file)
@@ -35258,11 +35258,6 @@ cp_parser_oacc_declare (cp_parser *parser, cp_token *pragma_tok)
        case GOMP_MAP_DEVICE_RESIDENT:
          break;
 
-       case GOMP_MAP_POINTER:
-         /* Generated by c_finish_omp_clauses from array sections;
-            avoid spurious diagnostics.  */
-         break;
-
        case GOMP_MAP_LINK:
          if (!global_bindings_p ()
              && (TREE_STATIC (decl)
index d1fb11973fdbbd5d6cd58e3bca6bc1643a726294..615d3aeab2a96f3004bf1865768331a64cf540af 100644 (file)
@@ -5002,6 +5002,10 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
              case GOMP_MAP_ALWAYS_TOFROM:
              case GOMP_MAP_RELEASE:
              case GOMP_MAP_DELETE:
+             case GOMP_MAP_FORCE_TO:
+             case GOMP_MAP_FORCE_FROM:
+             case GOMP_MAP_FORCE_TOFROM:
+             case GOMP_MAP_FORCE_PRESENT:
                OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION (c) = 1;
                break;
              default:
index ecba096c5c169bb4933937339efdb7851240b2c0..04509f3993854fad480727523bc3f16105ccd652 100644 (file)
@@ -16210,6 +16210,10 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
                    case GOMP_MAP_ALWAYS_FROM:
                    case GOMP_MAP_ALWAYS_TOFROM:
                    case GOMP_MAP_RELEASE:
+                   case GOMP_MAP_FORCE_TO:
+                   case GOMP_MAP_FORCE_FROM:
+                   case GOMP_MAP_FORCE_TOFROM:
+                   case GOMP_MAP_FORCE_PRESENT:
                      tkind_zero = GOMP_MAP_ZERO_LEN_ARRAY_SECTION;
                      break;
                    case GOMP_MAP_DELETE:
index 35e29c06776479f79693f6f27f458f1effa00e2f..e4555eacd2d6172416950bb3d43dad502243670a 100644 (file)
@@ -1,3 +1,8 @@
+2016-07-15  Cesar Philippidis  <cesar@codesourcery.com>
+
+       * testsuite/libgomp.oacc-c-c++-common/zero_length_subarrays.c: New
+       test.
+
 2016-07-03  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR middle-end/71734
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/zero_length_subarrays.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/zero_length_subarrays.c
new file mode 100644 (file)
index 0000000..8954551
--- /dev/null
@@ -0,0 +1,45 @@
+/* Exercise zero-length sub-arrays.  */
+
+const int n = 10;
+
+void
+subzero_present (int *a, int n)
+{
+#pragma acc data present (a[0:n])
+  ;
+#pragma acc data pcopy (a[0:n])
+  ;
+#pragma acc data pcopyin (a[0:n])
+  ;
+#pragma acc data pcopyout (a[0:n])
+  ;
+
+}
+
+void
+subzero (int *a, int n)
+{
+#pragma acc data create (a[0:n])
+  ;
+#pragma acc data copy (a[0:n])
+  ;
+#pragma acc data copyin (a[0:n])
+  ;
+#pragma acc data copyout (a[0:n])
+  ;
+}
+
+int
+main ()
+{
+  int a[n];
+
+#pragma acc data copy (a[0:n])
+  {
+    subzero_present (a, 0);
+  }
+
+  subzero (a, 0);
+
+  return 0;
+}