[OpenACC privatization] Largely extend diagnostics and corresponding testsuite covera...
authorThomas Schwinge <thomas@codesourcery.com>
Thu, 20 May 2021 14:11:37 +0000 (16:11 +0200)
committerThomas Schwinge <thomas@codesourcery.com>
Fri, 21 May 2021 18:09:59 +0000 (20:09 +0200)
gcc/
PR middle-end/90115
* flag-types.h (enum openacc_privatization): New.
* params.opt (-param=openacc-privatization): New.
* doc/invoke.texi (openacc-privatization): Document it.
* omp-general.h (get_openacc_privatization_dump_flags): New
function.
* omp-low.c (oacc_privatization_candidate_p): Add diagnostics.
* omp-offload.c (execute_oacc_device_lower)
<IFN_UNIQUE_OACC_PRIVATE>: Re-work diagnostics.
* target.def (goacc.adjust_private_decl): Add 'location_t'
parameter.
* doc/tm.texi: Regenerate.
* config/gcn/gcn-protos.h (gcn_goacc_adjust_private_decl): Adjust.
* config/gcn/gcn-tree.c (gcn_goacc_adjust_private_decl): Likewise.
* config/nvptx/nvptx.c (nvptx_goacc_adjust_private_decl):
Likewise.  Preserve it for...
(nvptx_goacc_expand_var_decl): ... use here.
gcc/testsuite/
PR middle-end/90115
* c-c++-common/goacc/privatization-1-compute-loop.c: New file.
* c-c++-common/goacc/privatization-1-compute.c: Likewise.
* c-c++-common/goacc/privatization-1-routine_gang-loop.c:
Likewise.
* c-c++-common/goacc/privatization-1-routine_gang.c: Likewise.
* gfortran.dg/goacc/privatization-1-compute-loop.f90: Likewise.
* gfortran.dg/goacc/privatization-1-compute.f90: Likewise.
* gfortran.dg/goacc/privatization-1-routine_gang-loop.f90:
Likewise.
* gfortran.dg/goacc/privatization-1-routine_gang.f90: Likewise.
* c-c++-common/goacc-gomp/nesting-1.c: Update.
* c-c++-common/goacc/private-reduction-1.c: Likewise.
* gfortran.dg/goacc/private-3.f95: Likewise.
libgomp/
PR middle-end/90115
* testsuite/libgomp.oacc-fortran/private-atomic-1-vector.f90: New
file.
* testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c: Update.
* testsuite/libgomp.oacc-c-c++-common/host_data-7.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-2.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-3.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-4.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-5.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-2.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-3.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-4.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-5.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-6.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-2.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-2.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-3.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-4.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-5.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-6.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-7.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-g-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-g-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-gwv-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-red-wv-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-v-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-w-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/parallel-reduction.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/private-atomic-1-gang.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/private-atomic-1.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/private-variables.c:
Likewise.
* testsuite/libgomp.oacc-c-c++-common/routine-4.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/static-variable-1.c:
Likewise.
* testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f: Likewise.
* testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f: Likewise.
* testsuite/libgomp.oacc-fortran/declare-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/host_data-5.F90: Likewise.
* testsuite/libgomp.oacc-fortran/if-1.f90: Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-1.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-2.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-3.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-6.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-vector-1.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-vector-2.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-1.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-2.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-3.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-4.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-5.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-6.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-7.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/optional-private.f90: Likewise.
* testsuite/libgomp.oacc-fortran/parallel-dims.f90: Likewise.
* testsuite/libgomp.oacc-fortran/private-atomic-1-gang.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/private-atomic-1-worker.f90:
Likewise.
* testsuite/libgomp.oacc-fortran/private-variables.f90: Likewise.
* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Likewise.
* testsuite/libgomp.oacc-fortran/routine-7.f90: Likewise.

92 files changed:
gcc/config/gcn/gcn-protos.h
gcc/config/gcn/gcn-tree.c
gcc/config/nvptx/nvptx.c
gcc/doc/invoke.texi
gcc/doc/tm.texi
gcc/flag-types.h
gcc/omp-general.h
gcc/omp-low.c
gcc/omp-offload.c
gcc/params.opt
gcc/target.def
gcc/testsuite/c-c++-common/goacc-gomp/nesting-1.c
gcc/testsuite/c-c++-common/goacc/private-reduction-1.c
gcc/testsuite/c-c++-common/goacc/privatization-1-compute-loop.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/goacc/privatization-1-compute.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/goacc/privatization-1-routine_gang-loop.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/goacc/privatization-1-routine_gang.c [new file with mode: 0644]
gcc/testsuite/gfortran.dg/goacc/private-3.f95
gcc/testsuite/gfortran.dg/goacc/privatization-1-compute-loop.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/goacc/privatization-1-compute.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang-loop.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.oacc-c-c++-common/firstprivate-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/host_data-7.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-2.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-3.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-4.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-local-worker-5.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-2.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-3.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-4.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-5.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-gang-6.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-vector-2.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-2.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-3.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-4.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-5.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-6.c
libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-private-vars-loop-worker-7.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-g-2.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-gwv-2.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-g-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-gwv-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-v-2.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-w-2.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-red-wv-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-v-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-w-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/loop-wv-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/parallel-reduction.c
libgomp/testsuite/libgomp.oacc-c-c++-common/private-atomic-1-gang.c
libgomp/testsuite/libgomp.oacc-c-c++-common/private-atomic-1.c
libgomp/testsuite/libgomp.oacc-c-c++-common/private-variables.c
libgomp/testsuite/libgomp.oacc-c-c++-common/routine-4.c
libgomp/testsuite/libgomp.oacc-c-c++-common/static-variable-1.c
libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90
libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-2.f
libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-3.f
libgomp/testsuite/libgomp.oacc-fortran/declare-1.f90
libgomp/testsuite/libgomp.oacc-fortran/host_data-5.F90
libgomp/testsuite/libgomp.oacc-fortran/if-1.f90
libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-1.f90
libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-2.f90
libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-3.f90
libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-gang-6.f90
libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-vector-1.f90
libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-vector-2.f90
libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-1.f90
libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-2.f90
libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-3.f90
libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-4.f90
libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-5.f90
libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-6.f90
libgomp/testsuite/libgomp.oacc-fortran/kernels-private-vars-loop-worker-7.f90
libgomp/testsuite/libgomp.oacc-fortran/optional-private.f90
libgomp/testsuite/libgomp.oacc-fortran/parallel-dims.f90
libgomp/testsuite/libgomp.oacc-fortran/private-atomic-1-gang.f90
libgomp/testsuite/libgomp.oacc-fortran/private-atomic-1-vector.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.oacc-fortran/private-atomic-1-worker.f90
libgomp/testsuite/libgomp.oacc-fortran/private-variables.f90
libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
libgomp/testsuite/libgomp.oacc-fortran/routine-7.f90

index 7ef7ae8..8bd0b43 100644 (file)
@@ -40,7 +40,7 @@ extern rtx gcn_gen_undef (machine_mode);
 extern bool gcn_global_address_p (rtx);
 extern tree gcn_goacc_adjust_propagation_record (tree record_type, bool sender,
                                                 const char *name);
-extern tree gcn_goacc_adjust_private_decl (tree var, int level);
+extern tree gcn_goacc_adjust_private_decl (location_t, tree var, int level);
 extern void gcn_goacc_reduction (gcall *call);
 extern bool gcn_hard_regno_rename_ok (unsigned int from_reg,
                                      unsigned int to_reg);
index 75ea50c..1eb8882 100644 (file)
@@ -578,7 +578,7 @@ gcn_goacc_adjust_propagation_record (tree record_type, bool sender,
 }
 
 tree
-gcn_goacc_adjust_private_decl (tree var, int level)
+gcn_goacc_adjust_private_decl (location_t, tree var, int level)
 {
   if (level != GOMP_DIM_GANG)
     return var;
index 60d3f07..6642bdf 100644 (file)
@@ -6680,7 +6680,7 @@ nvptx_truly_noop_truncation (poly_uint64, poly_uint64)
 /* Implement TARGET_GOACC_ADJUST_PRIVATE_DECL.  */
 
 static tree
-nvptx_goacc_adjust_private_decl (tree decl, int level)
+nvptx_goacc_adjust_private_decl (location_t loc, tree decl, int level)
 {
   gcc_checking_assert (!lookup_attribute ("oacc gang-private",
                                          DECL_ATTRIBUTES (decl)));
@@ -6689,14 +6689,12 @@ nvptx_goacc_adjust_private_decl (tree decl, int level)
      declarations.  */
   if (level == GOMP_DIM_GANG)
     {
-      if (dump_file && (dump_flags & TDF_DETAILS))
-       {
-         fprintf (dump_file, "Setting 'oacc gang-private' attribute for decl:");
-         print_generic_decl (dump_file, decl, TDF_SLIM);
-         fputc ('\n', dump_file);
-       }
       tree id = get_identifier ("oacc gang-private");
-      DECL_ATTRIBUTES (decl) = tree_cons (id, NULL, DECL_ATTRIBUTES (decl));
+      /* For later diagnostic purposes, pass LOC as VALUE (wrapped as a
+        TREE).  */
+      tree loc_tree = build_empty_stmt (loc);
+      DECL_ATTRIBUTES (decl)
+       = tree_cons (id, loc_tree, DECL_ATTRIBUTES (decl));
     }
 
   return decl;
@@ -6708,7 +6706,8 @@ static rtx
 nvptx_goacc_expand_var_decl (tree var)
 {
   /* Place "oacc gang-private" variables in shared memory.  */
-  if (lookup_attribute ("oacc gang-private", DECL_ATTRIBUTES (var)))
+  if (tree attr = lookup_attribute ("oacc gang-private",
+                                   DECL_ATTRIBUTES (var)))
     {
       gcc_checking_assert (VAR_P (var));
 
@@ -6728,6 +6727,50 @@ nvptx_goacc_expand_var_decl (tree var)
          bool existed = gang_private_shared_hmap.put (var, offset);
          gcc_checking_assert (!existed);
          gang_private_shared_size += tree_to_uhwi (DECL_SIZE_UNIT (var));
+
+         location_t loc = EXPR_LOCATION (TREE_VALUE (attr));
+#if 0 /* For some reason, this doesn't work.  */
+         if (dump_enabled_p ())
+           {
+             dump_flags_t l_dump_flags
+               = get_openacc_privatization_dump_flags ();
+
+             const dump_user_location_t d_u_loc
+               = dump_user_location_t::from_location_t (loc);
+/* PR100695 "Format decoder, quoting in 'dump_printf' etc." */
+#if __GNUC__ >= 10
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wformat"
+#endif
+             dump_printf_loc (l_dump_flags, d_u_loc,
+                              "variable %<%T%> adjusted for OpenACC"
+                              " privatization level: %qs\n",
+                              var, "gang");
+#if __GNUC__ >= 10
+# pragma GCC diagnostic pop
+#endif
+           }
+#else /* ..., thus emulate that, good enough for testsuite usage.  */
+         if (param_openacc_privatization != OPENACC_PRIVATIZATION_QUIET)
+           inform (loc,
+                   "variable %qD adjusted for OpenACC privatization level:"
+                   " %qs",
+                   var, "gang");
+         if (dump_file && (dump_flags & TDF_DETAILS))
+           {
+             /* 'dumpfile.c:dump_loc' */
+             fprintf (dump_file, "%s:%d:%d: ", LOCATION_FILE (loc),
+                      LOCATION_LINE (loc), LOCATION_COLUMN (loc));
+             fprintf (dump_file, "%s: ", "note");
+
+             fprintf (dump_file,
+                      "variable '");
+             print_generic_expr (dump_file, var, TDF_SLIM);
+             fprintf (dump_file,
+                      "' adjusted for OpenACC privatization level: '%s'\n",
+                      "gang");
+           }
+#endif
        }
       rtx addr = plus_constant (Pmode, gang_private_shared_sym, offset);
       return gen_rtx_MEM (TYPE_MODE (TREE_TYPE (var)), addr);
index 9bcbcdc..5cd4e2d 100644 (file)
@@ -14425,6 +14425,14 @@ With @option{--param=openacc-kernels=parloops}, OpenACC `kernels'
 constructs are handled by the @samp{parloops} pass, en bloc.
 This is the current default.
 
+@item openacc-privatization
+Specify mode of OpenACC privatization diagnostics for
+@option{-fopt-info-omp-note} and applicable
+@option{-fdump-tree-*-details}.
+With @option{--param=openacc-privatization=quiet}, don't diagnose.
+This is the current default.
+With @option{--param=openacc-privatization=noisy}, do diagnose.
+
 @end table
 
 The following choices of @var{name} are available on AArch64 targets:
index 78c330c..e3a080e 100644 (file)
@@ -6236,12 +6236,13 @@ like @code{cond_add@var{m}}.  The default implementation returns a zero
 constant of type @var{type}.
 @end deftypefn
 
-@deftypefn {Target Hook} tree TARGET_GOACC_ADJUST_PRIVATE_DECL (tree @var{var}, int @var{level})
+@deftypefn {Target Hook} tree TARGET_GOACC_ADJUST_PRIVATE_DECL (location_t @var{loc}, tree @var{var}, int @var{level})
 This hook, if defined, is used by accelerator target back-ends to adjust
 OpenACC variable declarations that should be made private to the given
 parallelism level (i.e. @code{GOMP_DIM_GANG}, @code{GOMP_DIM_WORKER} or
 @code{GOMP_DIM_VECTOR}).  A typical use for this hook is to force variable
 declarations at the @code{gang} level to reside in GPU shared memory.
+@var{loc} may be used for diagnostic purposes.
 
 You may also use the @code{TARGET_GOACC_EXPAND_VAR_DECL} hook if the
 adjusted variable declaration needs to be expanded to RTL in a non-standard
index d60bb30..375448e 100644 (file)
@@ -442,6 +442,13 @@ enum openacc_kernels
   OPENACC_KERNELS_PARLOOPS
 };
 
+/* Modes of OpenACC privatization diagnostics.  */
+enum openacc_privatization
+{
+  OPENACC_PRIVATIZATION_QUIET,
+  OPENACC_PRIVATIZATION_NOISY
+};
+
 #endif
 
 #endif /* ! GCC_FLAG_TYPES_H */
index aa04895..5c3e0f0 100644 (file)
@@ -132,4 +132,17 @@ enum omp_requires {
 
 extern GTY(()) enum omp_requires omp_requires_mask;
 
+static inline dump_flags_t
+get_openacc_privatization_dump_flags ()
+{
+  dump_flags_t l_dump_flags = MSG_NOTE;
+
+  /* For '--param=openacc-privatization=quiet', diagnostics only go to dump
+     files.  */
+  if (param_openacc_privatization == OPENACC_PRIVATIZATION_QUIET)
+    l_dump_flags |= MSG_PRIORITY_INTERNALS;
+
+  return l_dump_flags;
+}
+
 #endif /* GCC_OMP_GENERAL_H */
index 577676b..0d63e82 100644 (file)
@@ -10160,16 +10160,81 @@ lower_omp_for_lastprivate (struct omp_for_data *fd, gimple_seq *body_p,
    sometimes, using shared memory directly would be faster than
    broadcasting.  */
 
+static void
+oacc_privatization_begin_diagnose_var (const dump_flags_t l_dump_flags,
+                                      const location_t loc, const tree c,
+                                      const tree decl)
+{
+  const dump_user_location_t d_u_loc
+    = dump_user_location_t::from_location_t (loc);
+/* PR100695 "Format decoder, quoting in 'dump_printf' etc." */
+#if __GNUC__ >= 10
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wformat"
+#endif
+  dump_printf_loc (l_dump_flags, d_u_loc,
+                  "variable %<%T%> ", decl);
+#if __GNUC__ >= 10
+# pragma GCC diagnostic pop
+#endif
+  if (c)
+    dump_printf (l_dump_flags,
+                "in %qs clause ",
+                omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
+  else
+    dump_printf (l_dump_flags,
+                "declared in block ");
+}
+
 static bool
-oacc_privatization_candidate_p (const tree decl)
+oacc_privatization_candidate_p (const location_t loc, const tree c,
+                               const tree decl)
 {
+  dump_flags_t l_dump_flags = get_openacc_privatization_dump_flags ();
+
   bool res = true;
 
   if (res && !VAR_P (decl))
-    res = false;
+    {
+      res = false;
+
+      if (dump_enabled_p ())
+       {
+         oacc_privatization_begin_diagnose_var (l_dump_flags, loc, c, decl);
+         dump_printf (l_dump_flags,
+                      "potentially has improper OpenACC privatization level: %qs\n",
+                      get_tree_code_name (TREE_CODE (decl)));
+       }
+    }
 
   if (res && !TREE_ADDRESSABLE (decl))
-    res = false;
+    {
+      res = false;
+
+      if (dump_enabled_p ())
+       {
+         oacc_privatization_begin_diagnose_var (l_dump_flags, loc, c, decl);
+         dump_printf (l_dump_flags,
+                      "isn%'t candidate for adjusting OpenACC privatization level: %s\n",
+                      "not addressable");
+       }
+    }
+
+  if (res)
+    {
+      if (dump_enabled_p ())
+       {
+         oacc_privatization_begin_diagnose_var (l_dump_flags, loc, c, decl);
+         dump_printf (l_dump_flags,
+                      "is candidate for adjusting OpenACC privatization level\n");
+       }
+    }
+
+  if (dump_file && (dump_flags & TDF_DETAILS))
+    {
+      print_generic_decl (dump_file, decl, dump_flags);
+      fprintf (dump_file, "\n");
+    }
 
   return res;
 }
@@ -10185,7 +10250,7 @@ oacc_privatization_scan_clause_chain (omp_context *ctx, tree clauses)
       {
        tree decl = OMP_CLAUSE_DECL (c);
 
-       if (!oacc_privatization_candidate_p (decl))
+       if (!oacc_privatization_candidate_p (OMP_CLAUSE_LOCATION (c), c, decl))
          continue;
 
        gcc_checking_assert (!ctx->oacc_privatization_candidates.contains (decl));
@@ -10201,7 +10266,7 @@ oacc_privatization_scan_decl_chain (omp_context *ctx, tree decls)
 {
   for (tree decl = decls; decl; decl = DECL_CHAIN (decl))
     {
-      if (!oacc_privatization_candidate_p (decl))
+      if (!oacc_privatization_candidate_p (gimple_location (ctx->stmt), NULL, decl))
        continue;
 
       gcc_checking_assert (!ctx->oacc_privatization_candidates.contains (decl));
index 8bfb8b3..e907827 100644 (file)
@@ -2137,6 +2137,15 @@ execute_oacc_device_lower ()
 
                case IFN_UNIQUE_OACC_PRIVATE:
                  {
+                   dump_flags_t l_dump_flags
+                     = get_openacc_privatization_dump_flags ();
+
+                   location_t loc = gimple_location (stmt);
+                   if (LOCATION_LOCUS (loc) == UNKNOWN_LOCATION)
+                     loc = DECL_SOURCE_LOCATION (current_function_decl);
+                   const dump_user_location_t d_u_loc
+                     = dump_user_location_t::from_location_t (loc);
+
                    HOST_WIDE_INT level
                      = TREE_INT_CST_LOW (gimple_call_arg (call, 2));
                    gcc_checking_assert (level == -1
@@ -2146,31 +2155,65 @@ execute_oacc_device_lower ()
                         i < gimple_call_num_args (call);
                         i++)
                      {
+                       static char const *const axes[] =
+                       /* Must be kept in sync with GOMP_DIM enumeration.  */
+                         { "gang", "worker", "vector" };
+
                        tree arg = gimple_call_arg (call, i);
                        gcc_checking_assert (TREE_CODE (arg) == ADDR_EXPR);
                        tree decl = TREE_OPERAND (arg, 0);
-                       if (dump_file && (dump_flags & TDF_DETAILS))
+                       if (dump_enabled_p ())
+/* PR100695 "Format decoder, quoting in 'dump_printf' etc." */
+#if __GNUC__ >= 10
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wformat"
+#endif
+                         dump_printf_loc (l_dump_flags, d_u_loc,
+                                          "variable %<%T%> ought to be"
+                                          " adjusted for OpenACC"
+                                          " privatization level: %qs\n",
+                                          decl,
+                                          (level == -1
+                                           ? "UNKNOWN" : axes[level]));
+#if __GNUC__ >= 10
+# pragma GCC diagnostic pop
+#endif
+                       bool adjusted;
+                       if (level == -1)
+                         adjusted = false;
+                       else if (!targetm.goacc.adjust_private_decl)
+                         adjusted = false;
+                       else if (level == GOMP_DIM_VECTOR)
                          {
-                           static char const *const axes[] =
-                             /* Must be kept in sync with GOMP_DIM
-                                enumeration.  */
-                             { "gang", "worker", "vector" };
-                           fprintf (dump_file, "Decl UID %u has %s "
-                                    "partitioning:", DECL_UID (decl),
-                                    (level == -1 ? "UNKNOWN" : axes[level]));
-                           print_generic_decl (dump_file, decl, TDF_SLIM);
-                           fputc ('\n', dump_file);
+                           /* That's the default behavior.  */
+                           adjusted = true;
                          }
-                       if (level != -1
-                           && targetm.goacc.adjust_private_decl)
+                       else
                          {
                            tree oldtype = TREE_TYPE (decl);
                            tree newdecl
-                             = targetm.goacc.adjust_private_decl (decl, level);
-                           if (TREE_TYPE (newdecl) != oldtype
-                               || newdecl != decl)
+                             = targetm.goacc.adjust_private_decl (loc, decl,
+                                                                  level);
+                           adjusted = (TREE_TYPE (newdecl) != oldtype
+                                       || newdecl != decl);
+                           if (adjusted)
                              adjusted_vars.put (decl, newdecl);
                          }
+                       if (adjusted
+                           && dump_enabled_p ())
+/* PR100695 "Format decoder, quoting in 'dump_printf' etc." */
+#if __GNUC__ >= 10
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wformat"
+#endif
+                         dump_printf_loc (l_dump_flags, d_u_loc,
+                                          "variable %<%T%> adjusted for"
+                                          " OpenACC privatization level:"
+                                          " %qs\n",
+                                          decl, axes[level]);
+#if __GNUC__ >= 10
+# pragma GCC diagnostic pop
+#endif
                      }
                    remove = true;
                  }
index 82600b9..0d0dcd2 100644 (file)
@@ -795,6 +795,19 @@ Enum(openacc_kernels) String(decompose) Value(OPENACC_KERNELS_DECOMPOSE)
 EnumValue
 Enum(openacc_kernels) String(parloops) Value(OPENACC_KERNELS_PARLOOPS)
 
+-param=openacc-privatization=
+Common Joined Enum(openacc_privatization) Var(param_openacc_privatization) Init(OPENACC_PRIVATIZATION_QUIET) Param
+--param=openacc-privatization=[quiet|noisy]    Specify mode of OpenACC privatization diagnostics.
+
+Enum
+Name(openacc_privatization) Type(enum openacc_privatization)
+
+EnumValue
+Enum(openacc_privatization) String(quiet) Value(OPENACC_PRIVATIZATION_QUIET)
+
+EnumValue
+Enum(openacc_privatization) String(noisy) Value(OPENACC_PRIVATIZATION_NOISY)
+
 -param=parloops-chunk-size=
 Common Joined UInteger Var(param_parloops_chunk_size) Param Optimization
 Chunk size of omp schedule for loops parallelized by parloops.
index 660b69f..1dffedc 100644 (file)
@@ -1733,11 +1733,12 @@ OpenACC variable declarations that should be made private to the given\n\
 parallelism level (i.e. @code{GOMP_DIM_GANG}, @code{GOMP_DIM_WORKER} or\n\
 @code{GOMP_DIM_VECTOR}).  A typical use for this hook is to force variable\n\
 declarations at the @code{gang} level to reside in GPU shared memory.\n\
+@var{loc} may be used for diagnostic purposes.\n\
 \n\
 You may also use the @code{TARGET_GOACC_EXPAND_VAR_DECL} hook if the\n\
 adjusted variable declaration needs to be expanded to RTL in a non-standard\n\
 way.",
-tree, (tree var, int level),
+tree, (location_t loc, tree var, int level),
 NULL)
 
 DEFHOOK
index aaf0e7a..b0b7837 100644 (file)
@@ -1,7 +1,14 @@
+/* { dg-additional-options "-fopt-info-omp-note" } */
+/* { dg-additional-options "--param=openacc-privatization=noisy" } for
+   testing/documenting aspects of that functionality.  */
+
+
 void
 f_acc_data (void)
 {
 #pragma acc data
+  /* { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+  /* { dg-note {variable 'i' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 } */
   {
     int i;
 #pragma omp atomic write
@@ -13,6 +20,8 @@ void
 f_acc_kernels (void)
 {
 #pragma acc kernels
+  /* { dg-note {variable 'i' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-1 }
+     { dg-note {variable 'i' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } .-2 } */
   {
     int i;
 #pragma omp atomic write
@@ -27,6 +36,9 @@ f_acc_loop (void)
   int i;
 
 #pragma acc loop
+  /* { dg-note {variable 'i\.[0-9]+' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+  /* { dg-note {variable 'i' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 }
+     { dg-bogus {note: variable 'i' ought to be adjusted for OpenACC privatization level: 'UNKNOWN'} "TODO" { xfail *-*-* } .-3 } */
   for (i = 0; i < 2; ++i)
     {
 #pragma omp atomic write
@@ -38,6 +50,8 @@ void
 f_acc_parallel (void)
 {
 #pragma acc parallel
+  /* { dg-note {variable 'i' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-1 }
+     { dg-note {variable 'i' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } .-2 } */
   {
     int i;
 #pragma omp atomic write
index d4e3995..38f6b7a 100644 (file)
@@ -1,3 +1,7 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" } for
+   testing/documenting aspects of that functionality.  */
+
 int
 reduction ()
 {
@@ -5,6 +9,8 @@ reduction ()
 
   #pragma acc parallel
   #pragma acc loop private (r) reduction (+:r)
+  /* { dg-note {variable 'r' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} r { target *-*-* } .-1 } */
+  /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} i { target *-*-* } .-2 } */
   for (i = 0; i < 100; i++)
     r += 10;
 
diff --git a/gcc/testsuite/c-c++-common/goacc/privatization-1-compute-loop.c b/gcc/testsuite/c-c++-common/goacc/privatization-1-compute-loop.c
new file mode 100644 (file)
index 0000000..4bfb527
--- /dev/null
@@ -0,0 +1,95 @@
+/* OpenACC privatization: 'loop' construct inside compute construct */
+
+/* { dg-additional-options "-fopt-info-omp-note" } */
+/* { dg-additional-options "--param=openacc-privatization=noisy" } for
+   testing/documenting aspects of that functionality.  */
+
+/* See also '../../gfortran.dg/goacc/privatization-1-compute-loop.f90'.  */
+
+/* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
+   passed to 'incr' may be unset, and in that case, it will be set to [...]",
+   so to maintain compatibility with earlier Tcl releases, we manually
+   initialize counter variables:
+   { dg-line l_dummy[variable c_loop 0] }
+   { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
+   "WARNING: dg-line var l_dummy defined, but not used".  */
+
+extern int e;
+static int s;
+int g;
+
+void
+f (int i, int j, int a)
+{
+  extern int ex;
+  static int st;
+  int x, y;
+#pragma acc parallel
+#pragma acc loop collapse(2) private(a) private (e, s, g) private(ex, st, x, y) /* { dg-line l_loop[incr c_loop] } */
+  for (i = 0; i < 20; ++i)
+    for (j = 0; j < 25; ++j)
+      {
+       __label__ ll;
+       /* Nested scopes fun.  */
+       {
+         struct s_ss { int i; } ss;
+         {
+           extern int func (int *, int *, int *);
+           /* Don't know how to effect a 'CONST_DECL' here.  (See Fortran example.)  */
+           /* Don't know how to effect a 'RESULT_DECL' here; only saw this for OpenMP 'lastprivate'.  */
+
+           a = func (&i, &j, &a);
+         }
+         ss.i = a;
+         {
+           extern int func2 (int *, int *, int *, int *, int *, int *, int *);
+           extern int ext;
+           static int sta;
+           a = func2 (&e, &s, &g, &ex, &st, &ext, &sta);
+         }
+       }
+       x = a;
+#pragma acc atomic write
+       y = a;
+       {
+         int xx, yy;
+         xx = a;
+#pragma acc atomic write
+         yy = a;
+       }
+
+      ll:
+       ;
+      }
+  /* { dg-note {variable 'y' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+     { dg-note {variable 'y' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'st' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+     { dg-note {variable 'st' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'ex' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+     { dg-note {variable 'ex' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'g' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+     { dg-note {variable 'g' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 's' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+     { dg-note {variable 's' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'e' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+     { dg-note {variable 'e' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'a' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'j\.1' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'i\.0' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'j' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'i' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'll' declared in block potentially has improper OpenACC privatization level: 'label_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'struct struct s_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c } l_loop$c_loop }
+     { dg-note {variable 's_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c++ } l_loop$c_loop } */
+  /* { dg-note {variable 'ss' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'func' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'func2' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'ext' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+     { dg-note {variable 'ext' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'sta' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+     { dg-note {variable 'sta' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'xx' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'yy' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+     { dg-note {variable 'yy' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/privatization-1-compute.c b/gcc/testsuite/c-c++-common/goacc/privatization-1-compute.c
new file mode 100644 (file)
index 0000000..4de45e5
--- /dev/null
@@ -0,0 +1,90 @@
+/* OpenACC privatization: compute construct */
+
+/* { dg-additional-options "-fopt-info-omp-note" } */
+/* { dg-additional-options "--param=openacc-privatization=noisy" } for
+   testing/documenting aspects of that functionality.  */
+
+/* See also '../../gfortran.dg/goacc/privatization-1-compute.f90'.  */
+
+/* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
+   passed to 'incr' may be unset, and in that case, it will be set to [...]",
+   so to maintain compatibility with earlier Tcl releases, we manually
+   initialize counter variables:
+   { dg-line l_dummy[variable c_compute 0] }
+   { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
+   "WARNING: dg-line var l_dummy defined, but not used".  */
+
+extern int e;
+static int s;
+int g;
+
+void
+f (int i, int j, int a)
+{
+  extern int ex;
+  static int st;
+  int x, y;
+#pragma acc parallel private(i, j, a) private (e, s, g) private(ex, st, x, y) /* { dg-line l_compute[incr c_compute] } */
+      {
+       __label__ ll;
+       /* Nested scopes fun.  */
+       {
+         struct s_ss { int i; } ss;
+         {
+           extern int func (int *, int *, int *);
+           /* Don't know how to effect a 'CONST_DECL' here.  (See Fortran example.)  */
+           /* Don't know how to effect a 'RESULT_DECL' here; only saw this for OpenMP 'lastprivate'.  */
+
+           a = func (&i, &j, &a);
+         }
+         ss.i = a;
+         {
+           extern int func2 (int *, int *, int *, int *, int *, int *, int *);
+           extern int ext;
+           static int sta;
+           a = func2 (&e, &s, &g, &ex, &st, &ext, &sta);
+         }
+       }
+       x = a;
+#pragma acc atomic write
+       y = a;
+       {
+         int xx, yy;
+         xx = a;
+#pragma acc atomic write
+         yy = a;
+       }
+
+      ll:
+       ;
+      }
+  /* { dg-note {variable 'y' in 'private' clause is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_compute$c_compute }
+     { dg-note {variable 'y' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_compute$c_compute } */
+  /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "TODO" { xfail *-*-* } l_compute$c_compute } */
+  /* { dg-note {variable 'st' in 'private' clause is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_compute$c_compute }
+     { dg-note {variable 'st' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_compute$c_compute } */
+  /* { dg-note {variable 'ex' in 'private' clause is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_compute$c_compute }
+     { dg-note {variable 'ex' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_compute$c_compute } */
+  /* { dg-note {variable 'g' in 'private' clause is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_compute$c_compute }
+     { dg-note {variable 'g' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_compute$c_compute } */
+  /* { dg-note {variable 's' in 'private' clause is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_compute$c_compute }
+     { dg-note {variable 's' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_compute$c_compute } */
+  /* { dg-note {variable 'e' in 'private' clause is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_compute$c_compute }
+     { dg-note {variable 'e' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_compute$c_compute } */
+  /* { dg-note {variable 'a' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_compute$c_compute } */
+  /* { dg-note {variable 'j' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_compute$c_compute } */
+  /* { dg-note {variable 'i' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_compute$c_compute } */
+  /* { dg-note {variable 'll' declared in block potentially has improper OpenACC privatization level: 'label_decl'} "TODO" { target *-*-* } l_compute$c_compute } */
+  /* { dg-note {variable 'struct struct s_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c } l_compute$c_compute }
+     { dg-note {variable 's_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c++ } l_compute$c_compute } */
+  /* { dg-note {variable 'ss' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
+  /* { dg-note {variable 'func' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { target *-*-* } l_compute$c_compute } */
+  /* { dg-note {variable 'func2' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { target *-*-* } l_compute$c_compute } */
+  /* { dg-note {variable 'ext' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_compute$c_compute }
+     { dg-note {variable 'ext' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_compute$c_compute } */
+  /* { dg-note {variable 'sta' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_compute$c_compute }
+     { dg-note {variable 'sta' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_compute$c_compute } */
+  /* { dg-note {variable 'xx' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
+  /* { dg-note {variable 'yy' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_compute$c_compute }
+     { dg-note {variable 'yy' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_compute$c_compute } */
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/privatization-1-routine_gang-loop.c b/gcc/testsuite/c-c++-common/goacc/privatization-1-routine_gang-loop.c
new file mode 100644 (file)
index 0000000..fcc233b
--- /dev/null
@@ -0,0 +1,95 @@
+/* OpenACC privatization: 'loop' construct inside 'routine' */
+
+/* { dg-additional-options "-fopt-info-omp-note" } */
+/* { dg-additional-options "--param=openacc-privatization=noisy" } for
+   testing/documenting aspects of that functionality.  */
+
+/* See also '../../gfortran.dg/goacc/privatization-1-routine_gang-loop.f90'.  */
+
+/* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
+   passed to 'incr' may be unset, and in that case, it will be set to [...]",
+   so to maintain compatibility with earlier Tcl releases, we manually
+   initialize counter variables:
+   { dg-line l_dummy[variable c_loop 0] }
+   { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
+   "WARNING: dg-line var l_dummy defined, but not used".  */
+
+extern int e;
+static int s;
+int g;
+
+#pragma acc routine gang
+void
+f (int i, int j, int a)
+{
+  extern int ex;
+  static int st;
+  int x, y;
+#pragma acc loop collapse(2) private(a) private (e, s, g) private(ex, st, x, y) /* { dg-line l_loop[incr c_loop] } */
+  for (i = 0; i < 20; ++i)
+    for (j = 0; j < 25; ++j)
+      {
+       __label__ ll;
+       /* Nested scopes fun.  */
+       {
+         struct s_ss { int i; } ss;
+         {
+           extern int func (int *, int *, int *);
+           /* Don't know how to effect a 'CONST_DECL' here.  (See Fortran example.)  */
+           /* Don't know how to effect a 'RESULT_DECL' here; only saw this for OpenMP 'lastprivate'.  */
+
+           a = func (&i, &j, &a);
+         }
+         ss.i = a;
+         {
+           extern int func2 (int *, int *, int *, int *, int *, int *, int *);
+           extern int ext;
+           static int sta;
+           a = func2 (&e, &s, &g, &ex, &st, &ext, &sta);
+         }
+       }
+       x = a;
+#pragma acc atomic write
+       y = a;
+       {
+         int xx, yy;
+         xx = a;
+#pragma acc atomic write
+         yy = a;
+       }
+
+      ll:
+       ;
+      }
+  /* { dg-note {variable 'y' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+     { dg-note {variable 'y' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'st' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+     { dg-note {variable 'st' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'ex' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+     { dg-note {variable 'ex' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'g' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+     { dg-note {variable 'g' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 's' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+     { dg-note {variable 's' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'e' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+     { dg-note {variable 'e' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'a' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'j\.1' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'i\.0' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'j' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'i' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'll' declared in block potentially has improper OpenACC privatization level: 'label_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'struct struct s_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c } l_loop$c_loop }
+     { dg-note {variable 's_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c++ } l_loop$c_loop } */
+  /* { dg-note {variable 'ss' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'func' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'func2' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'ext' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+     { dg-note {variable 'ext' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'sta' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+     { dg-note {variable 'sta' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'xx' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+  /* { dg-note {variable 'yy' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+     { dg-note {variable 'yy' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop } */
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/privatization-1-routine_gang.c b/gcc/testsuite/c-c++-common/goacc/privatization-1-routine_gang.c
new file mode 100644 (file)
index 0000000..cd6708f
--- /dev/null
@@ -0,0 +1,93 @@
+/* OpenACC privatization: 'routine' */
+
+/* { dg-additional-options "-fopt-info-omp-note" } */
+/* { dg-additional-options "--param=openacc-privatization=noisy" } for
+   testing/documenting aspects of that functionality.  */
+
+/* See also '../../gfortran.dg/goacc/privatization-1-routine_gang.f90'.  */
+
+/* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
+   passed to 'incr' may be unset, and in that case, it will be set to [...]",
+   so to maintain compatibility with earlier Tcl releases, we manually
+   initialize counter variables:
+   { dg-line l_dummy[variable c_routine 0] }
+   { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
+   "WARNING: dg-line var l_dummy defined, but not used".  */
+
+extern int e;
+static int s;
+int g;
+#pragma acc declare device_resident(e, s, g)
+
+#pragma acc routine gang /* { dg-line l_routine[incr c_routine] } */
+void
+f (int i, int j, int a)
+{
+  extern int ex;
+  static int st;
+#pragma acc declare device_resident(ex /* , st */)
+  int x, y;
+      {
+       __label__ ll;
+       /* Nested scopes fun.  */
+       {
+         struct s_ss { int i; } ss;
+         {
+           extern int func (int *, int *, int *);
+           /* Don't know how to effect a 'CONST_DECL' here.  (See Fortran example.)  */
+           /* Don't know how to effect a 'RESULT_DECL' here; only saw this for OpenMP 'lastprivate'.  */
+
+           a = func (&i, &j, &a);
+         }
+         ss.i = a;
+         {
+           extern int func2 (int *, int *, int *, int *, int *, int *, int *);
+           extern int ext;
+           static int sta;
+#pragma acc declare device_resident(ext /* , sta */)
+           a = func2 (&e, &s, &g, &ex, &st, &ext, &sta);
+         }
+       }
+       x = a;
+#pragma acc atomic write
+       y = a;
+       {
+         int xx, yy;
+         xx = a;
+#pragma acc atomic write
+         yy = a;
+       }
+
+      ll:
+       ;
+      }
+}
+  /* { dg-note {variable 'y' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
+     { dg-note {variable 'y' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+  /* { dg-note {variable 'x' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "TODO" { xfail *-*-* } l_routine$c_routine } */
+  /* { dg-note {variable 'st' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
+     { dg-note {variable 'st' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+  /* { dg-note {variable 'ex' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
+     { dg-note {variable 'ex' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+  /* { dg-note {variable 'g' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
+     { dg-note {variable 'g' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+  /* { dg-note {variable 's' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
+     { dg-note {variable 's' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+  /* { dg-note {variable 'e' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
+     { dg-note {variable 'e' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+  /* { dg-note {variable 'a' declared in block potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+  /* { dg-note {variable 'j' declared in block potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+  /* { dg-note {variable 'i' declared in block potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+  /* { dg-note {variable 'll' declared in block potentially has improper OpenACC privatization level: 'label_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+  /* { dg-note {variable 'struct struct s_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c xfail *-*-* } l_routine$c_routine }
+     { dg-note {variable 's_ss' declared in block potentially has improper OpenACC privatization level: 'type_decl'} "TODO" { target c++ xfail *-*-* } l_routine$c_routine } */
+  /* { dg-note {variable 'ss' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "TODO" { xfail *-*-* } l_routine$c_routine } */
+  /* { dg-note {variable 'func' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+  /* { dg-note {variable 'func2' declared in block potentially has improper OpenACC privatization level: 'function_decl'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+  /* { dg-note {variable 'ext' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
+     { dg-note {variable 'ext' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+  /* { dg-note {variable 'sta' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
+     { dg-note {variable 'sta' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
+  /* { dg-note {variable 'xx' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "TODO" { xfail *-*-* } l_routine$c_routine } */
+  /* { dg-note {variable 'yy' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { xfail *-*-* } l_routine$c_routine }
+     { dg-note {variable 'yy' ought to be adjusted for OpenACC privatization level: 'gang'} "TODO" { xfail *-*-* } l_routine$c_routine } */
index a7c6d81..1bfb4f1 100644 (file)
@@ -1,7 +1,9 @@
-! { dg-do compile }
-
 ! test for private variables in a reduction clause
 
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" } for
+! testing/documenting aspects of that functionality.
+
 program test
   implicit none
   integer, parameter :: n = 100
@@ -16,6 +18,7 @@ program test
   !$acc parallel private (k)
   k = 0
   !$acc loop reduction (+:k)
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
   do i = 1, n
      k = k + 1
   end do
diff --git a/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute-loop.f90 b/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute-loop.f90
new file mode 100644 (file)
index 0000000..bcd7159
--- /dev/null
@@ -0,0 +1,57 @@
+! OpenACC privatization: 'loop' construct
+
+! { dg-additional-options "-fopt-info-omp-note" }
+! { dg-additional-options "--param=openacc-privatization=noisy" } for
+! testing/documenting aspects of that functionality.
+
+! See also '../../c-c++-common/goacc/privatization-1-compute-loop.c'.
+!TODO More cases should be added here.
+
+! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
+! passed to 'incr' may be unset, and in that case, it will be set to [...]",
+! so to maintain compatibility with earlier Tcl releases, we manually
+! initialize counter variables:
+! { dg-line l_dummy[variable c_loop 0] }
+! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
+! "WARNING: dg-line var l_dummy defined, but not used".
+
+module m
+contains
+  subroutine f (i, j, a)
+    implicit none
+    integer :: i, j, a
+    integer :: x, y
+    integer, parameter :: c = 3
+    integer, external :: g
+
+    !$acc parallel
+    !$acc loop collapse(2) private(a) private(x, y) ! { dg-line l_loop[incr c_loop] }
+    do i = 1, 20
+       do j = 1, 25
+          ! Can't have nested scopes fun.  (Fortran 'block' construct supported only starting with OpenACC 3.1.)
+
+          ! Don't know how to effect a 'LABEL_DECL' here.
+          ! Don't know how to effect a 'TYPE_DECL' here.
+          ! Don't know how to effect a 'FUNCTION_DECL' here.
+          ! Don't know how to effect a 'RESULT_DECL' here.
+          ! Don't know how to effect a 'VAR_DECL' here.
+          ! (See C/C++ example.)
+
+          a = g (i, j, a, c)
+          x = a
+          !$acc atomic write
+          y = a
+       end do
+    end do
+    ! { dg-note {variable 'count\.[0-9]+' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'i' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'j' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'a' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'y' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'y' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop }
+    !$acc end parallel
+  end subroutine f
+end module m
diff --git a/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute.f90 b/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute.f90
new file mode 100644 (file)
index 0000000..ed7e9ec
--- /dev/null
@@ -0,0 +1,48 @@
+! OpenACC privatization: compute construct
+
+! { dg-additional-options "-fopt-info-omp-note" }
+! { dg-additional-options "--param=openacc-privatization=noisy" } for
+! testing/documenting aspects of that functionality.
+
+! See also '../../c-c++-common/goacc/privatization-1-compute.c'.
+!TODO More cases should be added here.
+
+! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
+! passed to 'incr' may be unset, and in that case, it will be set to [...]",
+! so to maintain compatibility with earlier Tcl releases, we manually
+! initialize counter variables:
+! { dg-line l_dummy[variable c_compute 0] }
+! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
+! "WARNING: dg-line var l_dummy defined, but not used".
+
+module m
+contains
+  subroutine f (i, j, a)
+    implicit none
+    integer :: i, j, a
+    integer :: x, y
+    integer, parameter :: c = 3
+    integer, external :: g
+
+    !$acc parallel private(i, j, a) private(x, y) ! { dg-line l_compute[incr c_compute] }
+          ! Can't have nested scopes fun.  (Fortran 'block' construct supported only starting with OpenACC 3.1.)
+
+          ! Don't know how to effect a 'LABEL_DECL' here.
+          ! Don't know how to effect a 'TYPE_DECL' here.
+          ! Don't know how to effect a 'FUNCTION_DECL' here.
+          ! Don't know how to effect a 'RESULT_DECL' here.
+          ! Don't know how to effect a 'VAR_DECL' here.
+          ! (See C/C++ example.)
+
+          a = g (i, j, a, c)
+          x = a
+          !$acc atomic write ! ... to force 'TREE_ADDRESSABLE'.
+          y = a
+    !$acc end parallel
+    ! { dg-note {variable 'i' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'j' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'a' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
+  end subroutine f
+end module m
diff --git a/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang-loop.f90 b/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang-loop.f90
new file mode 100644 (file)
index 0000000..db6d822
--- /dev/null
@@ -0,0 +1,56 @@
+! OpenACC privatization: 'loop' construct inside 'routine'
+
+! { dg-additional-options "-fopt-info-omp-note" }
+! { dg-additional-options "--param=openacc-privatization=noisy" } for
+! testing/documenting aspects of that functionality.
+
+! See also '../../c-c++-common/goacc/privatization-1-routine_gang-loop.c'.
+!TODO More cases should be added here.
+
+! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
+! passed to 'incr' may be unset, and in that case, it will be set to [...]",
+! so to maintain compatibility with earlier Tcl releases, we manually
+! initialize counter variables:
+! { dg-line l_dummy[variable c_loop 0] }
+! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
+! "WARNING: dg-line var l_dummy defined, but not used".
+
+module m
+contains
+  subroutine f (i, j, a)
+    implicit none
+    integer :: i, j, a
+    !$acc routine (f) gang
+    integer :: x, y
+    integer, parameter :: c = 3
+    integer, external :: g
+
+    !$acc loop collapse(2) private(a) private(x, y) ! { dg-line l_loop[incr c_loop] }
+    do i = 1, 20
+       do j = 1, 25
+          ! Can't have nested scopes fun.  (Fortran 'block' construct supported only starting with OpenACC 3.1.)
+
+          ! Don't know how to effect a 'LABEL_DECL' here.
+          ! Don't know how to effect a 'TYPE_DECL' here.
+          ! Don't know how to effect a 'FUNCTION_DECL' here.
+          ! Don't know how to effect a 'RESULT_DECL' here.
+          ! Don't know how to effect a 'VAR_DECL' here.
+          ! (See C/C++ example.)
+
+          a = g (i, j, a, c)
+          x = a
+          !$acc atomic write
+          y = a
+       end do
+    end do
+    ! { dg-note {variable 'count\.[0-9]+' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'i' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'j' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'a' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'y' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'y' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop }
+  end subroutine f
+end module m
diff --git a/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang.f90 b/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang.f90
new file mode 100644 (file)
index 0000000..725bd5e
--- /dev/null
@@ -0,0 +1,47 @@
+! OpenACC privatization: 'routine'
+
+! { dg-additional-options "-fopt-info-omp-note" }
+! { dg-additional-options "--param=openacc-privatization=noisy" } for
+! testing/documenting aspects of that functionality.
+
+! See also '../../c-c++-common/goacc/privatization-1-routine_gang.c'.
+!TODO More cases should be added here.
+
+! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
+! passed to 'incr' may be unset, and in that case, it will be set to [...]",
+! so to maintain compatibility with earlier Tcl releases, we manually
+! initialize counter variables:
+! { dg-line l_dummy[variable c_routine 0] }
+! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
+! "WARNING: dg-line var l_dummy defined, but not used".
+
+module m
+contains
+  subroutine f (i, j, a)
+    implicit none
+    integer :: i, j, a
+    !$acc routine (f) gang ! { dg-line l_routine[incr c_routine] }
+    integer :: x, y
+    integer, parameter :: c = 3
+    integer, external :: g
+
+          ! Can't have nested scopes fun.  (Fortran 'block' construct supported only starting with OpenACC 3.1.)
+
+          ! Don't know how to effect a 'LABEL_DECL' here.
+          ! Don't know how to effect a 'TYPE_DECL' here.
+          ! Don't know how to effect a 'FUNCTION_DECL' here.
+          ! Don't know how to effect a 'RESULT_DECL' here.
+          ! Don't know how to effect a 'VAR_DECL' here.
+          ! (See C/C++ example.)
+
+          a = g (i, j, a, c)
+          x = a
+          !$acc atomic write ! ... to force 'TREE_ADDRESSABLE'.
+          y = a
+  end subroutine f
+    ! { dg-note {variable 'i' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_routine$c_routine }
+    ! { dg-note {variable 'j' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_routine$c_routine }
+    ! { dg-note {variable 'a' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { xfail *-*-* } l_routine$c_routine }
+    ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { xfail *-*-* } l_routine$c_routine }
+    ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "TODO" { xfail *-*-* } l_routine$c_routine }
+end module m
index 0990e3d..fff0c28 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 /* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
    aspects of that functionality.  */
 
@@ -15,9 +21,11 @@ void t1 ()
     ary[i] = ~0;
   
 #pragma acc parallel num_gangs (32) copy (ok) firstprivate (val) copy(ary, ondev)
+  /* { dg-note {variable 'i' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   {
     ondev = acc_on_device (acc_device_not_host);
 #pragma acc loop gang(static:1)
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
     for (unsigned i = 0; i < 32; i++)
       {
        if (val != 2)
@@ -79,6 +87,7 @@ void t3 ()
 
   #pragma acc parallel num_gangs (n) firstprivate (a)
   #pragma acc loop gang
+  /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   for (i = 0; i < n; i++)
     {
       a = a + i;
@@ -124,6 +133,7 @@ void t4 ()
   /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-2 } */
   {
 #pragma acc loop gang
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
     for (i = 0; i < 32; i++)
       arr[i] += x;
   }
index 6830ef1..66501e6 100644 (file)
@@ -1,6 +1,11 @@
-/* { dg-do run } */
-
 /* Test if, if_present clauses on host_data construct.  */
+
+/* { dg-additional-options "-fopt-info-all-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-all-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 /* C/C++ variant of 'libgomp.oacc-fortran/host_data-5.F90' */
 
 #include <assert.h>
@@ -14,15 +19,19 @@ foo (float *p, intptr_t host_p, int cond)
 #pragma acc data copyin(host_p)
   {
 #pragma acc host_data use_device(p) if_present
+    /* { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
     /* p not mapped yet, so it will be equal to the host pointer.  */
     assert (p == (float *) host_p);
 
 #pragma acc data copy(p[0:100])
+    /* { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
     {
       /* Not inside a host_data construct, so p is still the host pointer.  */
       assert (p == (float *) host_p);
 
 #pragma acc host_data use_device(p)
+      /* { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
       {
 #if ACC_MEM_SHARED
        assert (p == (float *) host_p);
@@ -33,6 +42,7 @@ foo (float *p, intptr_t host_p, int cond)
       }
 
 #pragma acc host_data use_device(p) if_present
+      /* { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
       {
 #if ACC_MEM_SHARED
        assert (p == (float *) host_p);
@@ -43,6 +53,8 @@ foo (float *p, intptr_t host_p, int cond)
       }
 
 #pragma acc host_data use_device(p) if(cond)
+      /* { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+      /* { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target { ! openacc_host_selected } } .-2 } */
       {
 #if ACC_MEM_SHARED
        assert (p == (float *) host_p);
index dd83557..e08cfa5 100644 (file)
@@ -3,11 +3,17 @@
 /* { dg-additional-options "-fopt-info-omp-all" } */
 /* { dg-additional-options "--param=openacc-kernels=decompose" } */
 
+/* { dg-additional-options "-fopt-info-all-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-all-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 /* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
    passed to 'incr' may be unset, and in that case, it will be set to [...]",
    so to maintain compatibility with earlier Tcl releases, we manually
    initialize counter variables:
-   { dg-line l_dummy[variable c_loop_i 0] }
+   { dg-line l_dummy[variable c_compute 0 c_loop_i 0] }
    { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
    "WARNING: dg-line var l_dummy defined, but not used".  */
 
@@ -22,15 +28,19 @@ int main()
 #define N 123
   int b[N] = { 0 };
 
-#pragma acc kernels
+#pragma acc kernels /* { dg-line l_compute[incr c_compute] } */
   {
     int c = 234; /* { dg-message "note: beginning 'gang-single' part in OpenACC 'kernels' region" } */
+    /* { dg-note {variable 'c' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_compute$c_compute }
+       { dg-note {variable 'c\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
 
     /*TODO Hopefully, this is the same issue as '../../../gcc/testsuite/c-c++-common/goacc/kernels-decompose-ice-1.c'.  */
     (volatile int *) &c;
 
 #pragma acc loop independent gang /* { dg-line l_loop_i[incr c_loop_i] } */
     /* { dg-message "note: parallelized loop nest in OpenACC 'kernels' region" "" { target *-*-* } l_loop_i$c_loop_i } */
+    /* { dg-note {variable 'i' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop_i$c_loop_i } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop_i$c_loop_i } */
     /* { dg-optimized "assigned OpenACC gang loop parallelism" "" { target *-*-* } l_loop_i$c_loop_i } */
     for (int i = 0; i < N; ++i)
       b[i] = c;
index bcbe28a..f28513d 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <assert.h>
 
 /* Test of worker-private variables declared in a local scope, broadcasting
@@ -12,30 +18,40 @@ main (int argc, char* argv[])
     arr[i] = i;
 
   #pragma acc kernels copy(arr)
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   {
     int j;
 
     #pragma acc loop gang(num:32)
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
     for (i = 0; i < 32; i++)
       {
        #pragma acc loop worker(num:32)
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+       /* { dg-note {variable 'x' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
        for (j = 0; j < 32; j++)
          {
            int k;
            int x = i ^ j * 3;
 
            #pragma acc loop vector(length:32)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
          }
 
        #pragma acc loop worker(num:32)
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+       /* { dg-note {variable 'x' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
        for (j = 0; j < 32; j++)
          {
            int k;
            int x = i | j * 5;
            
            #pragma acc loop vector(length:32)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
          }
index a944486..21f2511 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <assert.h>
 
 /* Test of worker-private variables declared in a local scope, broadcasting
@@ -12,25 +18,32 @@ main (int argc, char* argv[])
     arr[i] = i;
 
   #pragma acc kernels copy(arr)
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   {
     int j;
 
     #pragma acc loop gang(num:32)
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
     for (i = 0; i < 32; i++)
       {
         #pragma acc loop worker(num:32)
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+       /* { dg-note {variable 'x' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
        for (j = 0; j < 32; j++)
          {
            int k;
            int x = i ^ j * 3;
 
            #pragma acc loop vector(length:32)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
            
            x = i | j * 5;
            
            #pragma acc loop vector(length:32)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
          }
index ba0b44d..8b4cde8 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <assert.h>
 
 /* Test of worker-private variables declared in a local scope, broadcasting
@@ -17,13 +23,18 @@ main (int argc, char* argv[])
     arr[i] = i;
 
   #pragma acc kernels copy(arr)
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   {
     int j;
 
     #pragma acc loop gang(num:32)
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
     for (i = 0; i < 32; i++)
       {
         #pragma acc loop worker(num:32)
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+       /* { dg-note {variable 'pt' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
        for (j = 0; j < 32; j++)
          {
            int k;
@@ -33,10 +44,12 @@ main (int argc, char* argv[])
            pt.y = i | j * 5;
 
            #pragma acc loop vector(length:32)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += pt.x * k;
            
            #pragma acc loop vector(length:32)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += pt.y * k;
          }
index 7189d2a..a658d16 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <assert.h>
 
 /* Test of worker-private variables declared in a local scope, broadcasting
@@ -17,13 +23,19 @@ main (int argc, char* argv[])
     arr[i] = i;
 
   #pragma acc kernels copy(arr)
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   {
     int j;
 
     #pragma acc loop gang(num:32)
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
     for (i = 0; i < 32; i++)
       {
         #pragma acc loop worker(num:32)
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+       /* { dg-note {variable 'pt' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-3 } */
+       /* { dg-note {variable 'ptp' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */
        for (j = 0; j < 32; j++)
          {
            int k;
@@ -34,12 +46,14 @@ main (int argc, char* argv[])
            pt.x = i ^ j * 3;
 
            #pragma acc loop vector(length:32)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += ptp->x * k;
 
            ptp->y = i | j * 5;
            
            #pragma acc loop vector(length:32)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += pt.y * k;
          }
index 854ad7e..b82b9bf 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <assert.h>
 
 /* Test of worker-private variables declared in a local scope, broadcasting
@@ -12,13 +18,18 @@ main (int argc, char* argv[])
     arr[i] = i;
 
   #pragma acc kernels copy(arr)
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   {
     int j;
 
     #pragma acc loop gang(num:32)
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
     for (i = 0; i < 32; i++)
       {
         #pragma acc loop worker(num:32)
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+       /* { dg-note {variable 'pt' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
        for (j = 0; j < 32; j++)
          {
            int k;
@@ -27,12 +38,14 @@ main (int argc, char* argv[])
            pt[0] = i ^ j * 3;
 
            #pragma acc loop vector(length:32)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += pt[0] * k;
 
            pt[1] = i | j * 5;
            
            #pragma acc loop vector(length:32)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += pt[1] * k;
          }
index 5bc90c2..38d89c7 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <assert.h>
 
 /* Test of gang-private variables declared on loop directive.  */
@@ -13,6 +19,8 @@ main (int argc, char* argv[])
   #pragma acc kernels copy(arr)
   {
     #pragma acc loop gang(num:32) private(x)
+    /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
     for (i = 0; i < 32; i++)
       {
        x = i * 2;
index 3eb1167..62dd12f 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <assert.h>
 
 /* Test of gang-private variables declared on loop directive, with broadcasting
@@ -14,11 +20,15 @@ main (int argc, char* argv[])
   #pragma acc kernels copy(arr)
   {
     #pragma acc loop gang(num:32) private(x)
+    /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+    /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
     for (i = 0; i < 32; i++)
       {
        x = i * 2;
 
        #pragma acc loop worker(num:32)
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
        for (int j = 0; j < 32; j++)
          arr[i * 32 + j] += x;
       }
index 86b9a71..c22c3b4 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <assert.h>
 
 /* Test of gang-private variables declared on loop directive, with broadcasting
@@ -14,11 +20,15 @@ main (int argc, char* argv[])
   #pragma acc kernels copy(arr)
   {
     #pragma acc loop gang(num:32) private(x)
+    /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+    /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
     for (i = 0; i < 32; i++)
       {
        x = i * 2;
 
        #pragma acc loop vector(length:32)
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
        for (int j = 0; j < 32; j++)
          arr[i * 32 + j] += x;
       }
index 4174248..27a8e80 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <assert.h>
 
 /* Test of gang-private addressable variable declared on loop directive, with
@@ -14,6 +20,10 @@ main (int argc, char* argv[])
   #pragma acc kernels copy(arr)
   {
     #pragma acc loop gang(num:32) private(x)
+    /* { dg-note {variable 'x' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+    /* { dg-note {variable 'p' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
+    /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */
     for (i = 0; i < 32; i++)
       {
         int *p = &x;
@@ -21,6 +31,7 @@ main (int argc, char* argv[])
        x = i * 2;
 
        #pragma acc loop worker(num:32)
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
        for (int j = 0; j < 32; j++)
          arr[i * 32 + j] += x;
 
index b160eaa..f570c22 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <assert.h>
 
 /* Test of gang-private array variable declared on loop directive, with
@@ -14,12 +20,16 @@ main (int argc, char* argv[])
   #pragma acc kernels copy(arr)
   {
     #pragma acc loop gang(num:32) private(x)
+    /* { dg-note {variable 'x' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+    /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
     for (i = 0; i < 32; i++)
       {
         for (int j = 0; j < 8; j++)
          x[j] = j * 2;
 
        #pragma acc loop worker(num:32)
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
        for (int j = 0; j < 32; j++)
          arr[i * 32 + j] += x[j % 8];
       }
index 88ab245..5b776f1 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <assert.h>
 
 /* Test of gang-private aggregate variable declared on loop directive, with
@@ -20,6 +26,9 @@ main (int argc, char* argv[])
   #pragma acc kernels copy(arr)
   {
     #pragma acc loop gang private(pt)
+    /* { dg-note {variable 'pt' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+    /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
     for (i = 0; i < 32; i++)
       {
         pt.x = i;
@@ -28,6 +37,7 @@ main (int argc, char* argv[])
        pt.attr[5] = i * 6;
 
        #pragma acc loop worker
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
        for (int j = 0; j < 32; j++)
          arr[i * 32 + j] += pt.x + pt.y + pt.z + pt.attr[5];
       }
index df4add1..696da0f 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <assert.h>
 
 /* Test of vector-private variables declared on loop directive.  */
@@ -11,18 +17,24 @@ main (int argc, char* argv[])
     arr[i] = i;
 
   #pragma acc kernels copy(arr)
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   {
     int j;
 
     #pragma acc loop gang(num:32)
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
     for (i = 0; i < 32; i++)
       {
         #pragma acc loop worker(num:32)
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
        for (j = 0; j < 32; j++)
          {
            int k;
 
            #pragma acc loop vector(length:32) private(x)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+           /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
            for (k = 0; k < 32; k++)
              {
                x = i ^ j * 3;
@@ -30,6 +42,8 @@ main (int argc, char* argv[])
              }
 
            #pragma acc loop vector(length:32) private(x)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+           /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
            for (k = 0; k < 32; k++)
              {
                x = i | j * 5;
index 53c56b2..2e3b635 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <assert.h>
 
 /* Test of vector-private variables declared on loop directive. Array type.  */
@@ -11,18 +17,24 @@ main (int argc, char* argv[])
     arr[i] = i;
 
   #pragma acc kernels copy(arr)
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   {
     int j;
 
     #pragma acc loop gang(num:32)
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
     for (i = 0; i < 32; i++)
       {
         #pragma acc loop worker(num:32)
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
        for (j = 0; j < 32; j++)
          {
            int k;
 
            #pragma acc loop vector(length:32) private(pt)
+           /* { dg-note {variable 'pt' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
            for (k = 0; k < 32; k++)
              {
                pt[0] = i ^ j * 3;
index 95db2f8..1aedc79 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <assert.h>
 
 /* Test of worker-private variables declared on a loop directive.  */
@@ -11,13 +17,17 @@ main (int argc, char* argv[])
     arr[i] = i;
 
   #pragma acc kernels copy(arr)
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   {
     int j;
 
     #pragma acc loop gang(num:32)
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
     for (i = 0; i < 32; i++)
       {
         #pragma acc loop worker(num:32) private(x)
+       /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
        for (j = 0; j < 32; j++)
          {
            x = i ^ j * 3;
index ceaa3ee..3bf62aa 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <assert.h>
 
 /* Test of worker-private variables declared on a loop directive, broadcasting
@@ -12,19 +18,25 @@ main (int argc, char* argv[])
     arr[i] = i;
 
   #pragma acc kernels copy(arr)
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   {
     int j;
 
     #pragma acc loop gang(num:32)
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
     for (i = 0; i < 32; i++)
       {
         #pragma acc loop worker(num:32) private(x)
+       /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
        for (j = 0; j < 32; j++)
          {
            int k;
            x = i ^ j * 3;
 
            #pragma acc loop vector(length:32)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
          }
index 193a1d1..8de5516 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <assert.h>
 
 /* Test of worker-private variables declared on a loop directive, broadcasting
@@ -12,30 +18,40 @@ main (int argc, char* argv[])
     arr[i] = i;
 
   #pragma acc kernels copy(arr)
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   {
     int j;
 
     #pragma acc loop gang(num:32)
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
     for (i = 0; i < 32; i++)
       {
         #pragma acc loop worker(num:32) private(x)
+       /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
        for (j = 0; j < 32; j++)
          {
            int k;
            x = i ^ j * 3;
 
            #pragma acc loop vector(length:32)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
          }
 
        #pragma acc loop worker(num:32) private(x)
+       /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
        for (j = 0; j < 32; j++)
          {
            int k;
            x = i | j * 5;
            
            #pragma acc loop vector(length:32)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
          }
index 4320cd8..425fe63 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <assert.h>
 
 /* Test of worker-private variables declared on a loop directive, broadcasting
@@ -12,25 +18,32 @@ main (int argc, char* argv[])
     arr[i] = i;
 
   #pragma acc kernels copy(arr)
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   {
     int j;
 
     #pragma acc loop gang(num:32)
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
     for (i = 0; i < 32; i++)
       {
         #pragma acc loop worker(num:32) private(x)
+       /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
        for (j = 0; j < 32; j++)
          {
            int k;
            x = i ^ j * 3;
 
            #pragma acc loop vector(length:32)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
            
            x = i | j * 5;
            
            #pragma acc loop vector(length:32)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
          }
index 80992ee..c027c02 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <assert.h>
 
 /* Test of worker-private variables declared on a loop directive, broadcasting
@@ -12,13 +18,19 @@ main (int argc, char* argv[])
     arr[i] = i;
 
   #pragma acc kernels copy(arr)
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   {
     int j;
 
     #pragma acc loop gang(num:32)
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
     for (i = 0; i < 32; i++)
       {
         #pragma acc loop worker(num:32) private(x)
+       /* { dg-note {variable 'x' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-1 } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
+       /* { dg-note {variable 'p' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */
        for (j = 0; j < 32; j++)
          {
            int k;
@@ -27,12 +39,14 @@ main (int argc, char* argv[])
            x = i ^ j * 3;
 
            #pragma acc loop vector(length:32)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
            
            *p = i | j * 5;
            
            #pragma acc loop vector(length:32)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
          }
index 005ba60..4f17566 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <assert.h>
 
 /* Test of worker-private variables declared on a loop directive, broadcasting
@@ -18,13 +24,18 @@ main (int argc, char* argv[])
     arr[i] = i;
 
   #pragma acc kernels copy(arr)
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   {
     int j;
 
     #pragma acc loop gang(num:32)
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
     for (i = 0; i < 32; i++)
       {
         #pragma acc loop worker(num:32) private(pt)
+       /* { dg-note {variable 'pt' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
        for (j = 0; j < 32; j++)
          {
            int k;
@@ -33,10 +44,12 @@ main (int argc, char* argv[])
            pt.y = i | j * 5;
 
            #pragma acc loop vector(length:32)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += pt.x * k;
            
            #pragma acc loop vector(length:32)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += pt.y * k;
          }
index 8d367fb..12b4c54 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <assert.h>
 
 /* Test of worker-private variables declared on loop directive, broadcasting
@@ -15,14 +21,19 @@ main (int argc, char* argv[])
   /* "pt" is treated as "present_or_copy" on the kernels directive because it
      is an array variable.  */
   #pragma acc kernels copy(arr)
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   {
     int j;
 
     #pragma acc loop gang(num:32)
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
     for (i = 0; i < 32; i++)
       {
         /* But here, it is made private per-worker.  */
         #pragma acc loop worker(num:32) private(pt)
+       /* { dg-note {variable 'pt' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
        for (j = 0; j < 32; j++)
          {
            int k;
@@ -30,12 +41,14 @@ main (int argc, char* argv[])
            pt[0] = i ^ j * 3;
 
            #pragma acc loop vector(length:32)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += pt[0] * k;
 
            pt[1] = i | j * 5;
            
            #pragma acc loop vector(length:32)
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += pt[1] * k;
          }
index 98f02e9..12272ad 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <stdio.h>
 #include <openacc.h>
 #include <gomp-constants.h>
@@ -14,8 +20,13 @@ int main ()
     ary[ix] = -1;
   
 #pragma acc parallel num_gangs(32) copy(ary) copy(ondev)
+  /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   {
 #pragma acc loop gang
+    /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+    /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
+    /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */
     for (unsigned ix = 0; ix < N; ix++)
       {
        if (acc_on_device (acc_device_not_host))
index 4152a4e..683bd12 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <stdio.h>
 #include <openacc.h>
 #include <gomp-constants.h>
@@ -14,8 +20,13 @@ int main ()
     ary[ix] = -1;
   
 #pragma acc parallel num_gangs(32) copy(ary) copy(ondev)
+  /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   {
 #pragma acc loop gang (static:1)
+    /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+    /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
+    /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */
     for (unsigned ix = 0; ix < N; ix++)
       {
        if (acc_on_device (acc_device_not_host))
index 5c84301..e5ed2ab 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <stdio.h>
 #include <openacc.h>
 #include <gomp-constants.h>
@@ -16,8 +22,13 @@ int main ()
   
 #pragma acc parallel num_gangs(32) num_workers(32) vector_length(32) \
            copy(ary) copy(ondev) copyout(gangsize, workersize, vectorsize)
+  /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
   {
 #pragma acc loop gang worker vector
+    /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+    /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
+    /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */
     for (unsigned ix = 0; ix < N; ix++)
       {
        if (acc_on_device (acc_device_not_host))
index a4f81a3..cb3878b 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <stdio.h>
 #include <openacc.h>
 #include <alloca.h>
@@ -49,8 +55,13 @@ int main ()
 
 #pragma acc parallel num_gangs(32) num_workers(32) vector_length(32) \
            copy(ary) copyout(gangsize, workersize, vectorsize)
+  /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
   {
 #pragma acc loop gang worker vector
+    /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+    /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
+    /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */
     for (unsigned ix = 0; ix < N; ix++)
       {
        int g, w, v;
index 7107502..0c84027 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <stdio.h>
 #include <openacc.h>
 #include <gomp-constants.h>
@@ -10,8 +16,14 @@ int main ()
   int t = 0, h = 0;
   
 #pragma acc parallel num_gangs(32) copy(ondev)
+  /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   {
 #pragma acc loop gang  reduction (+:t)
+    /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'val' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+    /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
+    /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */
+    /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } */
     for (unsigned ix = 0; ix < N; ix++)
       {
        int val = ix;
index 9c4a85f..c1a2d0c 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <stdio.h>
 #include <openacc.h>
 #include <gomp-constants.h>
@@ -12,8 +18,14 @@ int main ()
 
 #pragma acc parallel num_gangs(32) num_workers(32) vector_length(32) \
        copy(ondev) copyout(gangsize, workersize, vectorsize)
+  /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
   {
 #pragma acc loop gang worker vector reduction(+:t)
+    /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'val' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+    /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
+    /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */
+    /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } */
     for (unsigned ix = 0; ix < N; ix++)
       {
        int val = ix;
index 1173c1f..58c7b6a 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <stdio.h>
 #include <openacc.h>
 #include <gomp-constants.h>
@@ -12,8 +18,14 @@ int main ()
   int vectorsize;
 
 #pragma acc parallel vector_length(32) copy(ondev) copyout(vectorsize)
+  /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   {
 #pragma acc loop vector reduction (+:t)
+    /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'val' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+    /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
+    /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */
+    /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } */
     for (unsigned ix = 0; ix < N; ix++)
       {
        int val = ix;
index 84c2296..85931f5 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <stdio.h>
 #include <openacc.h>
 #include <gomp-constants.h>
@@ -12,10 +18,17 @@ int main ()
   int vectorsize;
 
 #pragma acc parallel vector_length(32) copy(q) copy(ondev) copyout(vectorsize)
+  /* { dg-note {variable 't' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+  /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
   {
     int t = q;
     
 #pragma acc loop vector reduction (+:t)
+    /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'val' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+    /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
+    /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */
+    /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } */
     for (unsigned ix = 0; ix < N; ix++)
       {
        int val = ix;
index 2f749e0..b9ceec9 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 /* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
    aspects of that functionality.  */
 
@@ -15,9 +21,15 @@ int main ()
 
 #pragma acc parallel num_workers(32) vector_length(32) copy(ondev) \
            copyout(workersize)
-  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-2 } */
+  /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-3 } */
   {
 #pragma acc loop worker reduction(+:t)
+    /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'val' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+    /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
+    /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */
+    /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } */
     for (unsigned ix = 0; ix < N; ix++)
       {
        int val = ix;
index 9727e22..ff5e4a1 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 /* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
    aspects of that functionality.  */
 
@@ -15,11 +21,18 @@ int main ()
 
 #pragma acc parallel num_workers(32) vector_length(32) copy(q) copy(ondev) \
            copyout(workersize)
-  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-2 } */
+  /* { dg-note {variable 't' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+  /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
+  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-4 } */
   {
     int t = q;
     
 #pragma acc loop worker reduction(+:t)
+    /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'val' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+    /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
+    /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */
+    /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } */
     for (unsigned ix = 0; ix < N; ix++)
       {
        int val = ix;
index c360ad1..5d60899 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <stdio.h>
 #include <openacc.h>
 #include <gomp-constants.h>
@@ -12,8 +18,14 @@ int main ()
   
 #pragma acc parallel num_workers(32) vector_length(32) copy(ondev) \
            copyout(workersize, vectorsize)
+  /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
   {
 #pragma acc loop worker vector reduction (+:t)
+    /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'val' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+    /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
+    /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */
+    /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } */
     for (unsigned ix = 0; ix < N; ix++)
       {
        int val = ix;
index 8c858f3..9ccc1a8 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <stdio.h>
 #include <openacc.h>
 #include <gomp-constants.h>
@@ -16,8 +22,13 @@ int main ()
   
 #pragma acc parallel vector_length(32) copy(ary) copy(ondev) \
            copyout(vectorsize)
+  /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
   {
 #pragma acc loop vector
+    /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+    /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
+    /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */
     for (unsigned ix = 0; ix < N; ix++)
       {
        if (acc_on_device (acc_device_not_host))
index d639e14..0e99ec6 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 /* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
    aspects of that functionality.  */
 
@@ -19,9 +25,14 @@ int main ()
   
 #pragma acc parallel num_workers(32) vector_length(32) copy(ary) copy(ondev) \
            copyout(workersize)
-  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "vector" { target *-*-* } .-2 } */
+  /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "vector" { target *-*-* } .-3 } */
   {
 #pragma acc loop worker
+    /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+    /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
+    /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */
     for (unsigned ix = 0; ix < N; ix++)
       {
        if (acc_on_device (acc_device_not_host))
index fd4e4cf..f4707d1 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <stdio.h>
 #include <openacc.h>
 #include <gomp-constants.h>
@@ -16,8 +22,13 @@ int main ()
   
 #pragma acc parallel num_workers(32) vector_length(32) copy(ary) copy(ondev) \
            copyout(workersize, vectorsize)
+  /* { dg-note {variable 'ix' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
   {
 #pragma acc loop worker vector
+    /* { dg-note {variable 'ix' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'g' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
+    /* { dg-note {variable 'w' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 } */
+    /* { dg-note {variable 'v' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 } */
     for (unsigned ix = 0; ix < N; ix++)
       {
        if (acc_on_device (acc_device_not_host))
index b15ee8b..f88babc 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 /* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
    aspects of that functionality.  */
 
@@ -63,6 +69,7 @@ main ()
 #pragma acc parallel num_gangs (10) reduction (+:s1) copy(s1)
   {
 #pragma acc loop gang reduction (+:s1)
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
     for (i = 0; i < 10; i++)
       s1++;
   }
index 28222c2..2c1ffb1 100644 (file)
@@ -1,38 +1,99 @@
+/* Tests for gang-private variables, 'atomic' access */
+
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
+/* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
+   passed to 'incr' may be unset, and in that case, it will be set to [...]",
+   so to maintain compatibility with earlier Tcl releases, we manually
+   initialize counter variables:
+   { dg-line l_dummy[variable c_compute 0 c_loop 0] }
+   { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
+   "WARNING: dg-line var l_dummy defined, but not used".  */
+
 #include <assert.h>
+#include <openacc.h>
 
 int main (void)
 {
   int ret;
 
-  #pragma acc parallel num_gangs(1) num_workers(32) copyout(ret)
+
+  ret = 0;
+  #pragma acc parallel num_gangs(1444) num_workers(32) reduction(+: ret) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-note {variable 'w' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_compute$c_compute }
+     { dg-note {variable 'w' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_compute$c_compute }
+     { dg-note {variable 'w' adjusted for OpenACC privatization level: 'gang'} "" { target { ! openacc_host_selected } } l_compute$c_compute } */
+  /* { dg-note {variable 'i' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
   {
-    int w = 0;
+    int w = -22;
 
-    #pragma acc loop worker
-    for (int i = 0; i < 32; i++)
+    #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+    for (int i = 0; i < 2232; i++)
       {
        #pragma acc atomic update
        w++;
       }
 
-    ret = (w == 32);
+    ret = (w == -22 + 2232);
   }
-  assert (ret);
+  if (acc_get_device_type () == acc_device_host)
+    assert (ret == 1);
+  else
+    assert (ret == 1444);
+
 
-  #pragma acc parallel num_gangs(1) vector_length(32) copyout(ret)
+  ret = 0;
+  #pragma acc parallel num_gangs(1414) vector_length(32) reduction(+: ret) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-note {variable 'v' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_compute$c_compute }
+     { dg-note {variable 'v' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_compute$c_compute }
+     { dg-note {variable 'v' adjusted for OpenACC privatization level: 'gang'} "" { target { ! openacc_host_selected } } l_compute$c_compute } */
+  /* { dg-note {variable 'i' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
   {
-    int v = 0;
+    int v = 10;
 
-    #pragma acc loop vector
-    for (int i = 0; i < 32; i++)
+    #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+    for (int i = 0; i < 3201; i++)
       {
        #pragma acc atomic update
        v++;
       }
 
-    ret = (v == 32);
+    ret = (v == 10 + 3201);
+  }
+  if (acc_get_device_type () == acc_device_host)
+    assert (ret == 1);
+  else
+    assert (ret == 1414);
+
+
+  ret = 0;
+#pragma acc parallel num_gangs(314) reduction(+: ret) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-note {variable 'v' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_compute$c_compute }
+     { dg-note {variable 'v' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_compute$c_compute }
+     { dg-note {variable 'v' adjusted for OpenACC privatization level: 'gang'} "" { target { ! openacc_host_selected } } l_compute$c_compute } */
+  {
+    int v = -222;
+
+#pragma acc atomic update
+    ++v;
+#pragma acc atomic update
+    ++v;
+#pragma acc atomic update
+    ++v;
+
+    ret += (v == -222 + 3);
   }
-  assert (ret);
+  if (acc_get_device_type () == acc_device_host)
+    assert (ret == 1);
+  else
+    assert (ret == 314);
+
 
   return 0;
 }
index 77197d8..e651012 100644 (file)
@@ -1,5 +1,11 @@
 // 'atomic' access of thread-private variable
 
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <assert.h>
 
 int main (void)
@@ -8,13 +14,20 @@ int main (void)
 
   res = 0;
 #pragma acc parallel reduction(+: res)
+  /* { dg-note {variable 'i' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   {
 #pragma acc loop vector reduction(+: res)
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
+    /* { dg-note {variable 'v' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 }
+       { dg-note {variable 'v' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } .-3 }
+       { dg-note {variable 'v' adjusted for OpenACC privatization level: 'vector'} "" { target { ! openacc_host_selected } } .-4 } */
+    /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 } */
     for (int i = 0; i < 2322; i++)
     {
       int v = -222;
 
 #pragma acc loop seq
+      /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
       for (int j = 0; j < 121; ++j)
        {
 #pragma acc atomic update
index 3cc6f15..366f818 100644 (file)
@@ -1,6 +1,20 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 /* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
    aspects of that functionality.  */
 
+/* It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
+   passed to 'incr' may be unset, and in that case, it will be set to [...]",
+   so to maintain compatibility with earlier Tcl releases, we manually
+   initialize counter variables:
+   { dg-line l_dummy[variable c_compute 0 c_loop 0] }
+   { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
+   "WARNING: dg-line var l_dummy defined, but not used".  */
+
 #include <assert.h>
 #include <openacc.h>
 
@@ -24,17 +38,20 @@ void local_g_1()
   for (i = 0; i < 32; i++)
     arr[i] = 3;
 
-  #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
-  /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } */
-  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-2 } */
+  #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-note {variable 'x' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
+  /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } l_compute$c_compute } */
+  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } l_compute$c_compute } */
   {
     int x;
 
-    #pragma acc loop gang(static:1)
+    #pragma acc loop gang(static:1) /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       x = i * 2;
 
-    #pragma acc loop gang(static:1)
+    #pragma acc loop gang(static:1) /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
        if (acc_on_device (acc_device_host))
@@ -58,31 +75,41 @@ void local_w_1()
   for (i = 0; i < 32 * 32 * 32; i++)
     arr[i] = i;
 
-  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32)
+  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
   {
     int j;
 
-    #pragma acc loop gang
+    #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
-        #pragma acc loop worker
+        #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'x' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (j = 0; j < 32; j++)
          {
            int k;
            int x = i ^ j * 3;
 
-           #pragma acc loop vector
+           #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
          }
 
-       #pragma acc loop worker
+       #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'x' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (j = 0; j < 32; j++)
          {
            int k;
            int x = i | j * 5;
            
-           #pragma acc loop vector
+           #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
          }
@@ -109,26 +136,33 @@ void local_w_2()
   for (i = 0; i < 32 * 32 * 32; i++)
     arr[i] = i;
 
-  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32)
+  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
   {
     int j;
 
-    #pragma acc loop gang
+    #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
-        #pragma acc loop worker
+        #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'x' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (j = 0; j < 32; j++)
          {
            int k;
            int x = i ^ j * 3;
 
-           #pragma acc loop vector
+           #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
            
            x = i | j * 5;
            
-           #pragma acc loop vector
+           #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
          }
@@ -155,14 +189,19 @@ void local_w_3()
   for (i = 0; i < 32 * 32 * 32; i++)
     arr[i] = i;
 
-  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32)
+  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
   {
     int j;
 
-    #pragma acc loop gang
+    #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
-        #pragma acc loop worker
+        #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'pt' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (j = 0; j < 32; j++)
          {
            int k;
@@ -171,11 +210,13 @@ void local_w_3()
            pt.x = i ^ j * 3;
            pt.y = i | j * 5;
 
-           #pragma acc loop vector
+           #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += pt.x * k;
            
-           #pragma acc loop vector
+           #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += pt.y * k;
          }
@@ -202,14 +243,22 @@ void local_w_4()
   for (i = 0; i < 32 * 32 * 32; i++)
     arr[i] = i;
 
-  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32)
+  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
   {
     int j;
 
-    #pragma acc loop gang
+    #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
-        #pragma acc loop worker
+        #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'pt' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+          { dg-note {variable 'pt' ought to be adjusted for OpenACC privatization level: 'worker'} "" { target *-*-* } l_loop$c_loop }
+          { dg-note {variable 'pt' adjusted for OpenACC privatization level: 'worker'} "TODO" { target { ! openacc_host_selected } xfail *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'ptp' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (j = 0; j < 32; j++)
          {
            int k;
@@ -219,13 +268,15 @@ void local_w_4()
            
            pt.x = i ^ j * 3;
 
-           #pragma acc loop vector
+           #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += ptp->x * k;
 
            ptp->y = i | j * 5;
            
-           #pragma acc loop vector
+           #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += pt.y * k;
          }
@@ -252,14 +303,19 @@ void local_w_5()
   for (i = 0; i < 32 * 32 * 32; i++)
     arr[i] = i;
 
-  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32)
+  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
   {
     int j;
 
-    #pragma acc loop gang
+    #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
-        #pragma acc loop worker
+        #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'pt' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (j = 0; j < 32; j++)
          {
            int k;
@@ -267,13 +323,15 @@ void local_w_5()
            
            pt[0] = i ^ j * 3;
 
-           #pragma acc loop vector
+           #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += pt[0] * k;
 
            pt[1] = i | j * 5;
            
-           #pragma acc loop vector
+           #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += pt[1] * k;
          }
@@ -299,11 +357,13 @@ void loop_g_1()
   for (i = 0; i < 32; i++)
     arr[i] = i;
 
-  #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
-  /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } */
-  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-2 } */
+  #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } l_compute$c_compute } */
+  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } l_compute$c_compute } */
   {
-    #pragma acc loop gang private(x)
+    #pragma acc loop gang private(x) /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+    /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
        x = i * 2;
@@ -326,15 +386,19 @@ void loop_g_2()
   for (i = 0; i < 32 * 32; i++)
     arr[i] = i;
 
-  #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
-  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } */
+  #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } l_compute$c_compute } */
   {
-    #pragma acc loop gang private(x)
+    #pragma acc loop gang private(x) /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+    /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+    /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
        x = i * 2;
 
-       #pragma acc loop worker
+       #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (int j = 0; j < 32; j++)
          arr[i * 32 + j] += x;
       }
@@ -355,15 +419,19 @@ void loop_g_3()
   for (i = 0; i < 32 * 32; i++)
     arr[i] = i;
 
-  #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
-  /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } */
+  #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } l_compute$c_compute } */
   {
-    #pragma acc loop gang private(x)
+    #pragma acc loop gang private(x) /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+    /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+    /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
        x = i * 2;
 
-       #pragma acc loop vector
+       #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (int j = 0; j < 32; j++)
          arr[i * 32 + j] += x;
       }
@@ -384,17 +452,33 @@ void loop_g_4()
   for (i = 0; i < 32 * 32; i++)
     arr[i] = i;
 
-  #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
-  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } */
+  #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } l_compute$c_compute } */
   {
-    #pragma acc loop gang private(x)
+    #pragma acc loop gang private(x) /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'x' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+       But, with optimizations enabled, per the '*.ssa' dump ('gcc/tree-ssa.c:execute_update_addresses_taken'):
+           No longer having address taken: x
+          Now a gimple register: x
+       However, 'x' remains in the candidate set:
+       { dg-note {variable 'x' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_loop$c_loop }
+       Now, for GCN offloading, 'adjust_private_decl' does the privatization change right away:
+       { dg-note {variable 'x' adjusted for OpenACC privatization level: 'gang'} "" { target openacc_radeon_accel_selected } l_loop$c_loop }
+       For nvptx offloading however, we first mark up 'x', and then later apply the privatization change -- or, with optimizations enabled, don't, because we then don't actually call 'expand_var_decl'.
+       { dg-note {variable 'x' adjusted for OpenACC privatization level: 'gang'} "" { target { openacc_nvidia_accel_selected && { ! __OPTIMIZE__ } } } l_loop$c_loop }
+       { dg-bogus {note: variable 'x' adjusted for OpenACC privatization level: 'gang'} "" { target { openacc_nvidia_accel_selected && __OPTIMIZE__ } } l_loop$c_loop }
+    */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+    /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+    /* { dg-note {variable 'p' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
         int *p = &x;
 
        x = i * 2;
 
-       #pragma acc loop worker
+       #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (int j = 0; j < 32; j++)
          arr[i * 32 + j] += x;
 
@@ -417,16 +501,22 @@ void loop_g_5()
   for (i = 0; i < 32 * 32; i++)
     arr[i] = i;
 
-  #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
-  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } */
+  #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } l_compute$c_compute } */
   {
-    #pragma acc loop gang private(x)
+    #pragma acc loop gang private(x) /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'x' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+       { dg-note {variable 'x' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_loop$c_loop }
+       { dg-note {variable 'x' adjusted for OpenACC privatization level: 'gang'} "" { target { ! openacc_host_selected } } l_loop$c_loop } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+    /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
         for (int j = 0; j < 8; j++)
          x[j] = j * 2;
 
-       #pragma acc loop worker
+       #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (int j = 0; j < 32; j++)
          arr[i * 32 + j] += x[j % 8];
       }
@@ -448,10 +538,13 @@ void loop_g_6()
   for (i = 0; i < 32 * 32; i++)
     arr[i] = i;
 
-  #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
-  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } */
+  #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } l_compute$c_compute } */
   {
-    #pragma acc loop gang private(pt)
+    #pragma acc loop gang private(pt) /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+    /* { dg-note {variable 'pt' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+    /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
         pt.x = i;
@@ -459,7 +552,8 @@ void loop_g_6()
        pt.z = i * 4;
        pt.attr[5] = i * 6;
 
-       #pragma acc loop worker
+       #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (int j = 0; j < 32; j++)
          arr[i * 32 + j] += pt.x + pt.y + pt.z + pt.attr[5];
       }
@@ -479,26 +573,34 @@ void loop_v_1()
   for (i = 0; i < 32 * 32 * 32; i++)
     arr[i] = i;
 
-  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32)
+  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
   {
     int j;
 
-    #pragma acc loop gang
+    #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
-        #pragma acc loop worker
+        #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (j = 0; j < 32; j++)
          {
            int k;
 
-           #pragma acc loop vector private(x)
+           #pragma acc loop vector private(x) /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+           /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              {
                x = i ^ j * 3;
                arr[i * 1024 + j * 32 + k] += x * k;
              }
 
-           #pragma acc loop vector private(x)
+           #pragma acc loop vector private(x) /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+           /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              {
                x = i | j * 5;
@@ -527,19 +629,25 @@ void loop_v_2()
   for (i = 0; i < 32 * 32 * 32; i++)
     arr[i] = i;
 
-  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32)
+  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
   {
     int j;
 
-    #pragma acc loop gang
+    #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
-        #pragma acc loop worker
+        #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (j = 0; j < 32; j++)
          {
            int k;
 
-           #pragma acc loop vector private(pt)
+           #pragma acc loop vector private(pt) /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+           /* { dg-note {variable 'pt' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              {
                pt[0] = i ^ j * 3;
@@ -570,15 +678,19 @@ void loop_w_1()
   for (i = 0; i < 32 * 32; i++)
     arr[i] = i;
 
-  #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
-  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } */
+  #pragma acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
+  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } l_compute$c_compute } */
   {
     int j;
 
-    #pragma acc loop gang
+    #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
-        #pragma acc loop worker private(x)
+        #pragma acc loop worker private(x) /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (j = 0; j < 32; j++)
          {
            x = i ^ j * 3;
@@ -605,20 +717,26 @@ void loop_w_2()
   for (i = 0; i < 32 * 32 * 32; i++)
     arr[i] = i;
 
-  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32)
+  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
   {
     int j;
 
-    #pragma acc loop gang
+    #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
-        #pragma acc loop worker private(x)
+        #pragma acc loop worker private(x) /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (j = 0; j < 32; j++)
          {
            int k;
            x = i ^ j * 3;
 
-           #pragma acc loop vector
+           #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
          }
@@ -645,31 +763,41 @@ void loop_w_3()
   for (i = 0; i < 32 * 32 * 32; i++)
     arr[i] = i;
 
-  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32)
+  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
   {
     int j;
 
-    #pragma acc loop gang
+    #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
-        #pragma acc loop worker private(x)
+        #pragma acc loop worker private(x) /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (j = 0; j < 32; j++)
          {
            int k;
            x = i ^ j * 3;
 
-           #pragma acc loop vector
+           #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
          }
 
-       #pragma acc loop worker private(x)
+       #pragma acc loop worker private(x) /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (j = 0; j < 32; j++)
          {
            int k;
            x = i | j * 5;
            
-           #pragma acc loop vector
+           #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
          }
@@ -696,26 +824,33 @@ void loop_w_4()
   for (i = 0; i < 32 * 32 * 32; i++)
     arr[i] = i;
 
-  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32)
+  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
   {
     int j;
 
-    #pragma acc loop gang
+    #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
-        #pragma acc loop worker private(x)
+        #pragma acc loop worker private(x) /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (j = 0; j < 32; j++)
          {
            int k;
            x = i ^ j * 3;
 
-           #pragma acc loop vector
+           #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
            
            x = i | j * 5;
            
-           #pragma acc loop vector
+           #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
          }
@@ -742,14 +877,22 @@ void loop_w_5()
   for (i = 0; i < 32 * 32 * 32; i++)
     arr[i] = i;
 
-  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32)
+  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
   {
     int j;
 
-    #pragma acc loop gang
+    #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
-        #pragma acc loop worker private(x)
+        #pragma acc loop worker private(x) /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'x' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+          { dg-note {variable 'x' ought to be adjusted for OpenACC privatization level: 'worker'} "" { target *-*-* } l_loop$c_loop }
+          { dg-note {variable 'x' adjusted for OpenACC privatization level: 'worker'} "TODO" { target { ! openacc_host_selected } xfail *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'p' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (j = 0; j < 32; j++)
          {
            int k;
@@ -757,13 +900,15 @@ void loop_w_5()
            
            x = i ^ j * 3;
 
-           #pragma acc loop vector
+           #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
            
            *p = i | j * 5;
            
-           #pragma acc loop vector
+           #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += x * k;
          }
@@ -791,14 +936,19 @@ void loop_w_6()
   for (i = 0; i < 32 * 32 * 32; i++)
     arr[i] = i;
 
-  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32)
+  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
   {
     int j;
 
-    #pragma acc loop gang
+    #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
-        #pragma acc loop worker private(pt)
+        #pragma acc loop worker private(pt) /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'pt' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (j = 0; j < 32; j++)
          {
            int k;
@@ -806,11 +956,13 @@ void loop_w_6()
            pt.x = i ^ j * 3;
            pt.y = i | j * 5;
 
-           #pragma acc loop vector
+           #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += pt.x * k;
            
-           #pragma acc loop vector
+           #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += pt.y * k;
          }
@@ -840,28 +992,35 @@ void loop_w_7()
 
   /* "pt" is treated as "present_or_copy" on the parallel directive because it
      is an array variable.  */
-  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32)
+  #pragma acc parallel copy(arr) num_gangs(32) num_workers(32) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute } */
   {
     int j;
 
-    #pragma acc loop gang
+    #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
         /* But here, it is made private per-worker.  */
-        #pragma acc loop worker private(pt)
+        #pragma acc loop worker private(pt) /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'pt' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+       /* { dg-note {variable 'k' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (j = 0; j < 32; j++)
          {
            int k;
            
            pt[0] = i ^ j * 3;
 
-           #pragma acc loop vector
+           #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += pt[0] * k;
 
            pt[1] = i | j * 5;
            
-           #pragma acc loop vector
+           #pragma acc loop vector /* { dg-line l_loop[incr c_loop] } */
+           /* { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
            for (k = 0; k < 32; k++)
              arr[i * 1024 + j * 32 + k] += pt[1] * k;
          }
@@ -887,15 +1046,17 @@ void parallel_g_1()
   for (i = 0; i < 32; i++)
     arr[i] = 3;
 
-  #pragma acc parallel private(x) copy(arr) num_gangs(32) num_workers(8) vector_length(32)
-  /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 } */
-  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-2 } */
+  #pragma acc parallel private(x) copy(arr) num_gangs(32) num_workers(8) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } l_compute$c_compute } */
+  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } l_compute$c_compute } */
   {
-    #pragma acc loop gang(static:1)
+    #pragma acc loop gang(static:1) /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       x = i * 2;
 
-    #pragma acc loop gang(static:1)
+    #pragma acc loop gang(static:1) /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
        if (acc_on_device (acc_device_host))
@@ -918,17 +1079,20 @@ void parallel_g_2()
   for (i = 0; i < 32 * 32; i++)
     arr[i] = i;
 
-  #pragma acc parallel private(x) copy(arr) num_gangs(32) num_workers(2) vector_length(32)
-  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 } */
+  #pragma acc parallel private(x) copy(arr) num_gangs(32) num_workers(2) vector_length(32) /* { dg-line l_compute[incr c_compute] } */
+  /* { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } l_compute$c_compute } */
   {
-    #pragma acc loop gang
+    #pragma acc loop gang /* { dg-line l_loop[incr c_loop] } */
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
+    /* { dg-note {variable 'j' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
     for (i = 0; i < 32; i++)
       {
         int j;
        for (j = 0; j < 32; j++)
          x[j] = j * 2;
        
-       #pragma acc loop worker
+       #pragma acc loop worker /* { dg-line l_loop[incr c_loop] } */
+       /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop } */
        for (j = 0; j < 32; j++)
          arr[i * 32 + j] += x[31 - j];
       }
index d6ff44d..0402e44 100644 (file)
@@ -1,3 +1,9 @@
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 #include <stdlib.h>
 #include <stdio.h>
 
@@ -11,6 +17,7 @@ vector (int *a)
   int i;
 
 #pragma acc loop vector
+  /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   for (i = 0; i < N; i++)
     a[i] -= a[i]; 
 }
@@ -22,9 +29,11 @@ worker (int *b)
   int i, j;
 
 #pragma acc loop worker
+  /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   for (i = 0; i < N; i++)
     {
 #pragma acc loop vector
+      /* { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
       for (j = 0; j < M; j++)
         b[i * M + j] += b[i  * M + j]; 
     }
@@ -37,6 +46,7 @@ gang (int *a)
   int i;
 
 #pragma acc loop gang worker vector
+  /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
   for (i = 0; i < N; i++)
     a[i] -= i; 
 }
@@ -66,6 +76,7 @@ main(int argc, char **argv)
 #pragma acc parallel copy (a[0:N])
   {
 #pragma acc loop seq
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
     for (i = 0; i < N; i++)
       seq (&a[0]);
   }
@@ -79,6 +90,7 @@ main(int argc, char **argv)
 #pragma acc parallel copy (a[0:N])
   {
 #pragma acc loop seq
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
     for (i = 0; i < N; i++)
       gang (&a[0]);
   }
@@ -109,6 +121,7 @@ main(int argc, char **argv)
 #pragma acc parallel copy (a[0:N])
   {
 #pragma acc loop
+    /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 } */
     for (i = 0; i < N; i++)
       vector (&a[0]);
   }
index 0c071c3..6a4c6a0 100644 (file)
@@ -9,6 +9,12 @@
    variables" (only visible to members of the GitHub OpenACC organization).
 */
 
+/* { dg-additional-options "-fopt-info-note-omp" }
+   { dg-additional-options "--param=openacc-privatization=noisy" }
+   { dg-additional-options "-foffload=-fopt-info-note-omp" }
+   { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+   for testing/documenting aspects of that functionality.  */
+
 /* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
    aspects of that functionality.  */
 
@@ -40,6 +46,9 @@ static void t0_c(void)
 #pragma acc parallel \
   reduction(max:num_gangs_actual) \
   reduction(max:result)
+      /* { dg-note {variable 'var' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-3 }
+        { dg-note {variable 'var' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } .-4 }
+        { dg-note {variable 'var' adjusted for OpenACC privatization level: 'gang'} "" { target { ! openacc_host_selected } } .-5 } */
       {
        num_gangs_actual = 1 + __builtin_goacc_parlevel_id(GOMP_DIM_GANG);
 
@@ -134,6 +143,9 @@ static void t1_c(void)
   num_gangs(num_gangs_request) \
   reduction(max:num_gangs_actual) \
   reduction(max:result)
+      /* { dg-note {variable 'var' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-4 }
+        { dg-note {variable 'var' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } .-5 }
+        { dg-note {variable 'var' adjusted for OpenACC privatization level: 'gang'} "" { target { ! openacc_host_selected } } .-6 } */
       {
        num_gangs_actual = 1 + __builtin_goacc_parlevel_id(GOMP_DIM_GANG);
 
@@ -290,6 +302,7 @@ static void t2(void)
 
 #pragma acc data \
   copy(results_1, results_2, results_3)
+  /* { dg-note {variable 'i' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 } */
   {
     for (int i = 0; i < i_limit; ++i)
       {
@@ -304,6 +317,10 @@ static void t2(void)
   present(results_1) \
   num_gangs(num_gangs_request_1) \
   async(1)
+       /* { dg-note {variable 'var' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-4 }
+          { dg-note {variable 'var' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } .-5 }
+          { dg-note {variable 'var' adjusted for OpenACC privatization level: 'gang'} "" { target { ! openacc_host_selected } } .-6 } */
+       /* { dg-note {variable 'tmp' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-7 } */
        {
          static int var = var_init_1;
 
@@ -327,6 +344,10 @@ static void t2(void)
   present(results_3) \
   num_gangs(num_gangs_request_3) \
   async(3)
+       /* { dg-note {variable 'var' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-4 }
+          { dg-note {variable 'var' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } .-5 }
+          { dg-note {variable 'var' adjusted for OpenACC privatization level: 'gang'} "" { target { ! openacc_host_selected } } .-6 } */
+       /* { dg-note {variable 'tmp' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-7 } */
        {
          static int var = var_init_3;
 
@@ -447,6 +468,9 @@ static void pr84992_1(void)
   int n[1];
   n[0] = 3;
 #pragma acc parallel copy(n)
+  /* { dg-note {variable 'test' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-1 }
+     { dg-note {variable 'test' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } .-2 }
+     { dg-note {variable 'test' adjusted for OpenACC privatization level: 'gang'} "" { target { ! openacc_host_selected } } .-3 } */
   {
     static const int test[] = {1,2,3,4};
     n[0] = test[n[0]];
index 1a8432c..ace9358 100644 (file)
@@ -1,6 +1,12 @@
 ! { dg-do run }
 ! { dg-additional-options "-cpp" }
-!
+
+! { dg-additional-options "-fopt-info-all-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-all-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 ! TODO: Have to disable the acc_on_device builtin for we want to test the
 ! libgomp library function?  The command line option
 ! '-fno-builtin-acc_on_device' is valid for C/C++/ObjC/ObjC++ but not for
@@ -20,6 +26,8 @@ if (acc_on_device (acc_device_nvidia)) STOP 4
 ! Host via offloading fallback mode.
 
 !$acc parallel if(.false.)
+! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } .-1 }
+!TODO Unhandled 'CONST_DECL' instances for constant arguments in 'acc_on_device' calls.
 if (.not. acc_on_device (acc_device_none)) STOP 5
 if (.not. acc_on_device (acc_device_host)) STOP 6
 if (acc_on_device (acc_device_not_host)) STOP 7
@@ -32,6 +40,7 @@ if (acc_on_device (acc_device_nvidia)) STOP 8
 ! Offloaded.
 
 !$acc parallel
+! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target { ! openacc_host_selected } } .-1 }
 if (acc_on_device (acc_device_none)) STOP 9
 if (acc_on_device (acc_device_host)) STOP 10
 if (.not. acc_on_device (acc_device_not_host)) STOP 11
index 56f99d4..56270b1 100644 (file)
@@ -1,6 +1,12 @@
 ! { dg-do run }
 ! { dg-additional-options "-cpp" }
-!
+
+! { dg-additional-options "-fopt-info-all-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-all-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 ! TODO: Have to disable the acc_on_device builtin for we want to test
 ! the libgomp library function?  The command line option
 ! '-fno-builtin-acc_on_device' is valid for C/C++/ObjC/ObjC++ but not
@@ -20,6 +26,8 @@
 !Host via offloading fallback mode.
 
 !$ACC PARALLEL IF(.FALSE.)
+! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } .-1 }
+!TODO Unhandled 'CONST_DECL' instances for constant arguments in 'acc_on_device' calls.
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NONE)) STOP 5
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST)) STOP 6
       IF (ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) STOP 7
@@ -32,6 +40,7 @@
 ! Offloaded.
 
 !$ACC PARALLEL
+! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target { ! openacc_host_selected } } .-1 }
       IF (ACC_ON_DEVICE (ACC_DEVICE_NONE)) STOP 9
       IF (ACC_ON_DEVICE (ACC_DEVICE_HOST)) STOP 10
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) STOP 11
index 5657238..a8b9cdd 100644 (file)
@@ -1,6 +1,12 @@
 ! { dg-do run }
 ! { dg-additional-options "-cpp" }
-!
+
+! { dg-additional-options "-fopt-info-all-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-all-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 ! TODO: Have to disable the acc_on_device builtin for we want to test
 ! the libgomp library function?  The command line option
 ! '-fno-builtin-acc_on_device' is valid for C/C++/ObjC/ObjC++ but not
@@ -20,6 +26,8 @@
 !Host via offloading fallback mode.
 
 !$ACC PARALLEL IF(.FALSE.)
+! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } .-1 }
+!TODO Unhandled 'CONST_DECL' instances for constant arguments in 'acc_on_device' calls.
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NONE)) STOP 5
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_HOST)) STOP 6
       IF (ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) STOP 7
@@ -32,6 +40,7 @@
 ! Offloaded.
 
 !$ACC PARALLEL
+! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target { ! openacc_host_selected } } .-1 }
       IF (ACC_ON_DEVICE (ACC_DEVICE_NONE)) STOP 9
       IF (ACC_ON_DEVICE (ACC_DEVICE_HOST)) STOP 10
       IF (.NOT. ACC_ON_DEVICE (ACC_DEVICE_NOT_HOST)) STOP 11
index 084f336..51776a1 100644 (file)
@@ -1,6 +1,12 @@
 ! { dg-do run }
 ! { dg-skip-if "" { *-*-* } { "-DACC_MEM_SHARED=1" } }
 
+! { dg-additional-options "-fopt-info-all-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-all-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 ! Tests to exercise the declare directive along with
 ! the clauses: copy
 !              copyin
@@ -34,6 +40,7 @@ subroutine subr5 (a, b, c, d)
   i = 0
 
   !$acc parallel
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
     do i = 1, N
       b(i) = a(i)
       c(i) = b(i)
@@ -55,6 +62,7 @@ subroutine subr4 (a, b)
   i = 0
 
   !$acc parallel
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
   do i = 1, N
     b(i) = a(i)
   end do
@@ -74,6 +82,7 @@ subroutine subr3 (a, c)
   i = 0
 
   !$acc parallel
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
   do i = 1, N
     a(i) = c(i)
     c(i) = 0
@@ -96,6 +105,7 @@ subroutine subr2 (a, b, c)
   i = 0
 
   !$acc parallel
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
   do i = 1, N
     b(i) = a(i)
     c(i) = b(i) + c(i) + 1
@@ -114,6 +124,7 @@ subroutine subr1 (a)
   i = 0
 
   !$acc parallel
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
   do i = 1, N
     a(i) = a(i) + 1
   end do
@@ -133,6 +144,9 @@ subroutine test (a, e)
 end subroutine
 
 subroutine subr0 (a, b, c, d)
+  ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } .-1 }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
+  ! { dg-note {variable 'a\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 }
   implicit none
   integer, parameter :: N = 8
   integer :: a(N)
@@ -198,6 +212,10 @@ subroutine subr0 (a, b, c, d)
 end subroutine
 
 program main
+  ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } .-1 }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
+  ! { dg-note {variable 'S\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 }
+  ! { dg-note {variable 'desc\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-4 }
   use vars
   use openacc
   implicit none
index 483ac3f..93e9ee0 100644 (file)
@@ -1,7 +1,13 @@
 ! { dg-do run }
 !
 ! Test if, if_present clauses on host_data construct.
-!
+
+! { dg-additional-options "-fopt-info-all-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-all-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 ! Fortran variant of 'libgomp.oacc-c-c++-common/host_data-7.c'.
 !
 program main
@@ -33,11 +39,24 @@ subroutine foo (p2, parr, host_p, host_parr, cond)
 #endif
   
   !$acc data copyin(host_p, host_parr)
+  ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target { ! openacc_host_selected } } .-1 }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target { ! openacc_host_selected } } .-2 }
+  ! { dg-note {variable 'p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 }
+  ! { dg-note {variable 'parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 }
+  ! { dg-note {variable 'parm\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target { ! openacc_host_selected } } .-5 }
 #if !ACC_MEM_SHARED
     if (acc_is_present(p, c_sizeof(p))) stop 5
     if (acc_is_present(parr, 1)) stop 6
 #endif
     !$acc host_data use_device(p, parr) if_present
+    ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+    ! { dg-note {variable 'transfer\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
+    ! { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 }
+    ! { dg-note {variable 'parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 }
+    ! { dg-note {variable 'host_parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 }
+    ! { dg-note {variable 'D\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-6 }
+    ! { dg-note {variable 'transfer\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-7 }
+    ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-8 }
       ! not mapped yet, so it will be equal to the host pointer.
       if (transfer(c_loc(p), host_p) /= host_p) stop 7
       if (transfer(c_loc(parr), host_parr) /= host_parr) stop 8
@@ -48,6 +67,17 @@ subroutine foo (p2, parr, host_p, host_parr, cond)
 #endif
 
     !$acc data copy(p, parr)
+    ! { dg-note {variable 'p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+    ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
+    ! { dg-note {variable 'parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 }
+    ! { dg-note {variable 'transfer\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 }
+    ! { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 }
+    ! { dg-note {variable 'host_parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-6 }
+    ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } .-7 }
+    ! { dg-note {variable 'parm\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-8 }
+    ! { dg-note {variable 'D\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-9 }
+    ! { dg-note {variable 'transfer\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-10 }
+    ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-11 }
       if (.not. acc_is_present(p, c_sizeof(p))) stop 11
       if (.not. acc_is_present(parr, 1)) stop 12
       ! Not inside a host_data construct, so still the host pointer.
@@ -55,6 +85,14 @@ subroutine foo (p2, parr, host_p, host_parr, cond)
       if (transfer(c_loc(parr), host_parr) /= host_parr) stop 14
       
       !$acc host_data use_device(p, parr)
+      ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+      ! { dg-note {variable 'transfer\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
+      ! { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 }
+      ! { dg-note {variable 'parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 }
+      ! { dg-note {variable 'host_parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 }
+      ! { dg-note {variable 'D\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-6 }
+      ! { dg-note {variable 'transfer\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-7 }
+      ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-8 }
 #if ACC_MEM_SHARED
         if (transfer(c_loc(p), host_p) /= host_p) stop 15
         if (transfer(c_loc(parr), host_parr) /= host_parr) stop 16
@@ -66,6 +104,14 @@ subroutine foo (p2, parr, host_p, host_parr, cond)
       !$acc end host_data
 
       !$acc host_data use_device(p, parr) if_present
+        ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+        ! { dg-note {variable 'transfer\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
+        ! { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 }
+        ! { dg-note {variable 'parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 }
+        ! { dg-note {variable 'host_parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 }
+        ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-6 }
+        ! { dg-note {variable 'D\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-7 }
+        ! { dg-note {variable 'transfer\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-8 }
 #if ACC_MEM_SHARED
         if (transfer(c_loc(p), host_p) /= host_p) stop 19
         if (transfer(c_loc(parr), host_parr) /= host_parr) stop 20
@@ -77,6 +123,14 @@ subroutine foo (p2, parr, host_p, host_parr, cond)
       !$acc end host_data
 
       !$acc host_data use_device(p, parr) if(cond)
+        ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+        ! { dg-note {variable 'transfer\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
+        ! { dg-note {variable 'host_p\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 }
+        ! { dg-note {variable 'parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-4 }
+        ! { dg-note {variable 'host_parr\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-5 }
+        ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-6 }
+        ! { dg-note {variable 'D\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-7 }
+        ! { dg-note {variable 'transfer\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "TODO" { target *-*-* } .-8 }
 #if ACC_MEM_SHARED
         if (transfer(c_loc(p), host_p) /= host_p) stop 23
         if (transfer(c_loc(parr), host_parr) /= host_parr) stop 24
index f3bf1ee..3089d6a 100644 (file)
@@ -1,6 +1,20 @@
 ! { dg-do run }
 ! { dg-additional-options "-cpp" }
 
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
+! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
+! passed to 'incr' may be unset, and in that case, it will be set to [...]",
+! so to maintain compatibility with earlier Tcl releases, we manually
+! initialize counter variables:
+! { dg-line l_dummy[variable c_compute 0] }
+! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
+! "WARNING: dg-line var l_dummy defined, but not used".  */
+
 program main
   use openacc
   implicit none
@@ -19,8 +33,11 @@ program main
 
   a(:) = 4.0
 
-  !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (1 == 1)
+  !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (1 == 1) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
      do i = 1, N
+        ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
+        !TODO Unhandled 'CONST_DECL' instances for constant argument in 'acc_on_device' call.
         if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
           b(i) = a(i) + 1
         else
@@ -41,8 +58,10 @@ program main
 
   a(:) = 16.0
 
-  !$acc parallel if (0 == 1)
+  !$acc parallel if (0 == 1) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
      do i = 1, N
+        ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
        if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
          b(i) = a(i) + 1
        else
@@ -57,8 +76,10 @@ program main
 
   a(:) = 8.0
 
-  !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (one == 1)
+  !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (one == 1) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -79,8 +100,10 @@ program main
 
   a(:) = 22.0
 
-  !$acc parallel if (zero == 1)
+  !$acc parallel if (zero == 1) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -95,8 +118,10 @@ program main
 
   a(:) = 16.0
 
-  !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (.TRUE.)
+  !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (.TRUE.) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -117,8 +142,10 @@ program main
 
   a(:) = 76.0
 
-  !$acc parallel if (.FALSE.)
+  !$acc parallel if (.FALSE.) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -135,8 +162,10 @@ program main
 
   nn = 1
 
-  !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (nn == 1)
+  !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (nn == 1) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -159,8 +188,10 @@ program main
 
   nn = 0
 
-  !$acc parallel if (nn == 1)
+  !$acc parallel if (nn == 1) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -177,8 +208,10 @@ program main
 
   nn = 1
 
-  !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0)
+  !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -201,8 +234,10 @@ program main
 
   nn = 0;
 
-  !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0)
+  !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -217,8 +252,10 @@ program main
 
   a(:) = 91.0
 
-  !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (-2 > 0)
+  !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (-2 > 0) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -233,8 +270,10 @@ program main
 
   a(:) = 43.0
 
-  !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (one == 1)
+  !$acc parallel copyin (a(1:N)) copyout (b(1:N)) if (one == 1) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -255,8 +294,10 @@ program main
 
   a(:) = 87.0
 
-  !$acc parallel if (one == 0)
+  !$acc parallel if (one == 0) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -333,8 +374,11 @@ program main
   b(:) = 0.0
 
   !$acc data copyin (a(1:N)) copyout (b(1:N)) if (1 == 1)
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+  ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
 
-    !$acc parallel present (a(1:N))
+    !$acc parallel present (a(1:N)) ! { dg-line l_compute[incr c_compute] }
+    ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
        do i = 1, N
            b(i) = a(i)
        end do
@@ -349,6 +393,7 @@ program main
   b(:) = 1.0
 
   !$acc data copyin (a(1:N)) copyout (b(1:N)) if (0 == 1)
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target { ! openacc_host_selected } } .-1 }
 
 #if !ACC_MEM_SHARED
   if (acc_is_present (a) .eqv. .TRUE.) STOP 21
@@ -361,18 +406,25 @@ program main
   b(:) = 21.0
 
   !$acc data copyin (a(1:N)) if (1 == 1)
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+  ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
 
 #if !ACC_MEM_SHARED
     if (acc_is_present (a) .eqv. .FALSE.) STOP 23
 #endif
 
     !$acc data copyout (b(1:N)) if (0 == 1)
+    ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+    ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
 #if !ACC_MEM_SHARED
       if (acc_is_present (b) .eqv. .TRUE.) STOP 24
 #endif
         !$acc data copyout (b(1:N)) if (1 == 1)
+        ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+        ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
 
-        !$acc parallel present (a(1:N)) present (b(1:N))
+        !$acc parallel present (a(1:N)) present (b(1:N)) ! { dg-line l_compute[incr c_compute] }
+        ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
           do i = 1, N
             b(i) = a(i)
           end do
@@ -452,8 +504,10 @@ program main
 
   a(:) = 4.0
 
-  !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (1 == 1)
+  !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (1 == 1) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
      do i = 1, N
+        ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
         if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
           b(i) = a(i) + 1
         else
@@ -474,8 +528,10 @@ program main
 
   a(:) = 16.0
 
-  !$acc kernels if (0 == 1)
+  !$acc kernels if (0 == 1) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
      do i = 1, N
+        ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
        if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
          b(i) = a(i) + 1
        else
@@ -490,8 +546,10 @@ program main
 
   a(:) = 8.0
 
-  !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (one == 1)
+  !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (one == 1) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -512,8 +570,10 @@ program main
 
   a(:) = 22.0
 
-  !$acc kernels if (zero == 1)
+  !$acc kernels if (zero == 1) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -528,8 +588,10 @@ program main
 
   a(:) = 16.0
 
-  !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (.TRUE.)
+  !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (.TRUE.) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -550,8 +612,10 @@ program main
 
   a(:) = 76.0
 
-  !$acc kernels if (.FALSE.)
+  !$acc kernels if (.FALSE.) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -568,8 +632,10 @@ program main
 
   nn = 1
 
-  !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (nn == 1)
+  !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (nn == 1) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -592,8 +658,10 @@ program main
 
   nn = 0
 
-  !$acc kernels if (nn == 1)
+  !$acc kernels if (nn == 1) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -610,8 +678,10 @@ program main
 
   nn = 1
 
-  !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0)
+  !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -634,8 +704,10 @@ program main
 
   nn = 0;
 
-  !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0)
+  !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if ((nn + nn) > 0) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -650,8 +722,10 @@ program main
 
   a(:) = 91.0
 
-  !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (-2 > 0)
+  !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (-2 > 0) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -666,8 +740,10 @@ program main
 
   a(:) = 43.0
 
-  !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (one == 1)
+  !$acc kernels copyin (a(1:N)) copyout (b(1:N)) if (one == 1) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -688,8 +764,10 @@ program main
 
   a(:) = 87.0
 
-  !$acc kernels if (one == 0)
+  !$acc kernels if (one == 0) ! { dg-line l_compute[incr c_compute] }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     do i = 1, N
+      ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_compute$c_compute }
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) then
         b(i) = a(i) + 1
       else
@@ -766,8 +844,11 @@ program main
   b(:) = 0.0
 
   !$acc data copyin (a(1:N)) copyout (b(1:N)) if (1 == 1)
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+  ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
 
-    !$acc kernels present (a(1:N))
+    !$acc kernels present (a(1:N)) ! { dg-line l_compute[incr c_compute] }
+    ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
        do i = 1, N
            b(i) = a(i)
        end do
@@ -782,6 +863,7 @@ program main
   b(:) = 1.0
 
   !$acc data copyin (a(1:N)) copyout (b(1:N)) if (0 == 1)
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target { ! openacc_host_selected } } .-1 }
 
 #if !ACC_MEM_SHARED
   if (acc_is_present (a) .eqv. .TRUE.) STOP 56
@@ -794,18 +876,25 @@ program main
   b(:) = 21.0
 
   !$acc data copyin (a(1:N)) if (1 == 1)
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+  ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
 
 #if !ACC_MEM_SHARED
     if (acc_is_present (a) .eqv. .FALSE.) STOP 58
 #endif
 
     !$acc data copyout (b(1:N)) if (0 == 1)
+    ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+    ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
 #if !ACC_MEM_SHARED
       if (acc_is_present (b) .eqv. .TRUE.) STOP 59
 #endif
         !$acc data copyout (b(1:N)) if (1 == 1)
+        ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+        ! { dg-note {variable 'parm\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
 
-        !$acc kernels present (a(1:N)) present (b(1:N))
+        !$acc kernels present (a(1:N)) present (b(1:N)) ! { dg-line l_compute[incr c_compute] }
+        ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
           do i = 1, N
             b(i) = a(i)
           end do
index bcc0476..0ae7c4b 100644 (file)
@@ -2,6 +2,12 @@
 
 ! { dg-do run }
 
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 program main
   integer :: x, i, arr(32)
 
@@ -11,6 +17,8 @@ program main
 
   !$acc kernels copy(arr)
   !$acc loop gang(num:32) private(x)
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+  ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
   do i = 1, 32
      x = i * 2;
      arr(i) = arr(i) + x;
index 5571059..e3ff248 100644 (file)
@@ -3,6 +3,12 @@
 
 ! { dg-do run }
 
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 program main
   integer :: x, i, j, arr(0:32*32)
 
@@ -12,10 +18,13 @@ program main
 
   !$acc kernels copy(arr)
   !$acc loop gang(num:32) private(x)
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+  ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
   do i = 0, 31
      x = i * 2;
 
      !$acc loop worker(num:32)
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
      do j = 0, 31
         arr(i * 32 + j) = arr(i * 32 + j) + x;
      end do
index 6abbed7..370a25a 100644 (file)
@@ -3,6 +3,12 @@
 
 ! { dg-do run }
 
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 program main
   integer :: x, i, j, arr(0:32*32)
 
@@ -12,10 +18,13 @@ program main
 
   !$acc kernels copy(arr)
   !$acc loop gang(num:32) private(x)
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+  ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
   do i = 0, 31
      x = i * 2;
 
      !$acc loop vector(length:32)
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
      do j = 0, 31
         arr(i * 32 + j) = arr(i * 32 + j) + x;
      end do
index d92be2d..abb86d0 100644 (file)
@@ -3,6 +3,12 @@
 
 ! { dg-do run }
 
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 program main
   type vec3
      integer x, y, z, attr(13)
@@ -17,6 +23,8 @@ program main
 
   !$acc kernels copy(arr)
   !$acc loop gang(num:32) private(pt)
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+  ! { dg-note {variable 'pt' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 }
   do i = 0, 31
      pt%x = i
      pt%y = i * 2
@@ -24,6 +32,7 @@ program main
      pt%attr(5) = i * 6
 
      !$acc loop vector(length:32)
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
      do j = 0, 31
         arr(i * 32 + j) = arr(i * 32 + j) + pt%x + pt%y + pt%z + pt%attr(5);
      end do
index e9c0fb3..fe796f3 100644 (file)
@@ -2,6 +2,12 @@
 
 ! { dg-do run }
 
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 program main
   integer :: x, i, j, k, idx, arr(0:32*32*32)
 
@@ -11,15 +17,21 @@ program main
 
   !$acc kernels copy(arr)
   !$acc loop gang(num:32)
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
   do i = 0, 31
      !$acc loop worker(num:8)
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
      do j = 0, 31
         !$acc loop vector(length:32) private(x)
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+        ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
         do k = 0, 31
            x = ieor(i, j * 3)
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k
         end do
         !$acc loop vector(length:32) private(x)
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+        ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
         do k = 0, 31
            x = ior(i, j * 5)
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k
index 13badb5..b5cefec 100644 (file)
@@ -2,6 +2,12 @@
 
 ! { dg-do run }
 
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 program main
   integer :: i, j, k, idx, arr(0:32*32*32), pt(2)
 
@@ -11,10 +17,14 @@ program main
 
   !$acc kernels copy(arr)
   !$acc loop gang(num:32)
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
   do i = 0, 31
      !$acc loop worker(num:8)
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
      do j = 0, 31
         !$acc loop vector(length:32) private(x, pt)
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+        ! { dg-note {variable 'pt' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 }
         do k = 0, 31
            pt(1) = ieor(i, j * 3)
            pt(2) = ior(i, j * 5)
index 04d732e..3fd1239 100644 (file)
@@ -2,6 +2,12 @@
 
 ! { dg-do run }
 
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 program main
   integer :: x, i, j, arr(0:32*32)
   common x
@@ -12,8 +18,11 @@ program main
 
   !$acc kernels copy(arr)
   !$acc loop gang(num:32) private(x)
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
   do i = 0, 31
      !$acc loop worker(num:8) private(x)
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+     ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
      do j = 0, 31
         x = ieor(i, j * 3)
         arr(i * 32 + j) = arr(i * 32 + j) + x
index 6c9a6b8..1dc5d9e 100644 (file)
@@ -3,6 +3,12 @@
 
 ! { dg-do run }
 
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 program main
   integer :: x, i, j, k, idx, arr(0:32*32*32)
 
@@ -12,12 +18,16 @@ program main
 
   !$acc kernels copy(arr)
   !$acc loop gang(num:32)
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
   do i = 0, 31
      !$acc loop worker(num:8) private(x)
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+     ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
      do j = 0, 31
         x = ieor(i, j * 3)
 
         !$acc loop vector(length:32)
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k
         end do
index fab14c3..25bc67a 100644 (file)
@@ -3,6 +3,12 @@
 
 ! { dg-do run }
 
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 program main
   integer :: x, i, j, k, idx, arr(0:32*32*32)
 
@@ -12,22 +18,29 @@ program main
 
   !$acc kernels copy(arr)
   !$acc loop gang(num:32)
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
   do i = 0, 31
      !$acc loop worker(num:8) private(x)
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+     ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
      do j = 0, 31
         x = ieor(i, j * 3)
 
         !$acc loop vector(length:32)
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k
         end do
      end do
 
      !$acc loop worker(num:8) private(x)
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+     ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
      do j = 0, 31
         x = ior(i, j * 5)
 
         !$acc loop vector(length:32)
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k
         end do
index 71f4a11..b3f66ea 100644 (file)
@@ -3,6 +3,12 @@
 
 ! { dg-do run }
 
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 program main
   integer :: x, i, j, k, idx, arr(0:32*32*32)
 
@@ -12,12 +18,16 @@ program main
 
   !$acc kernels copy(arr)
   !$acc loop gang(num:32)
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
   do i = 0, 31
      !$acc loop worker(num:8) private(x)
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+     ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
      do j = 0, 31
         x = ieor(i, j * 3)
 
         !$acc loop vector(length:32)
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k
         end do
@@ -25,6 +35,7 @@ program main
         x = ior(i, j * 5)
 
         !$acc loop vector(length:32)
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k
         end do
index bb45755..d9dbb07 100644 (file)
@@ -3,6 +3,12 @@
 
 ! { dg-do run }
 
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 program main
   integer :: i, j, k, idx, arr(0:32*32*32)
   integer, target :: x
@@ -14,13 +20,18 @@ program main
 
   !$acc kernels copy(arr)
   !$acc loop gang(num:32)
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
   do i = 0, 31
      !$acc loop worker(num:8) private(x, p)
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+     ! { dg-note {variable 'x' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 }
+     ! { dg-note {variable 'p' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-3 }
      do j = 0, 31
         p => x
         x = ieor(i, j * 3)
 
         !$acc loop vector(length:32)
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k
         end do
@@ -28,6 +39,7 @@ program main
         p = ior(i, j * 5)
 
         !$acc loop vector(length:32)
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k
         end do
index e169714..b4225c2 100644 (file)
@@ -3,6 +3,12 @@
 
 ! { dg-do run }
 
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 program main
   type vec2
      integer x, y
@@ -17,18 +23,23 @@ program main
 
   !$acc kernels copy(arr)
   !$acc loop gang(num:32)
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
   do i = 0, 31
      !$acc loop worker(num:8) private(pt)
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+     ! { dg-note {variable 'pt' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
      do j = 0, 31
         pt%x = ieor(i, j * 3)
         pt%y = ior(i, j * 5)
         
         !$acc loop vector(length:32)
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + pt%x * k
         end do
 
         !$acc loop vector(length:32)
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + pt%y * k
         end do
index e262c02..76bbda7 100644 (file)
@@ -3,6 +3,12 @@
 
 ! { dg-do run }
 
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 program main
   integer :: i, j, k, idx, arr(0:32*32*32), pt(2)
 
@@ -12,18 +18,23 @@ program main
 
   !$acc kernels copy(arr)
   !$acc loop gang(num:32)
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
   do i = 0, 31
      !$acc loop worker(num:8) private(pt)
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+     ! { dg-note {variable 'pt' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 }
      do j = 0, 31
         pt(1) = ieor(i, j * 3)
         pt(2) = ior(i, j * 5)
         
         !$acc loop vector(length:32)
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + pt(1) * k
         end do
 
         !$acc loop vector(length:32)
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + pt(2) * k
         end do
index 4d36d86..4e67809 100644 (file)
@@ -4,9 +4,16 @@
 
 ! { dg-do run }
 
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 ! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
 ! aspects of that functionality.
 
+
 program main
   implicit none
 
@@ -36,6 +43,8 @@ contains
     ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 }
     ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-2 }
     !$acc loop gang private(x)
+    ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+    ! { dg-note {variable 'x' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } .-2 }
     do i = 1, 32
        x = i * 2;
        arr(i) = arr(i) + x
@@ -62,6 +71,8 @@ contains
     !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
     ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 }
     !$acc loop gang private(pt)
+    ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+    ! { dg-note {variable 'pt' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } .-2 }
     do i = 0, 31
        pt%x = i
        pt%y = i * 2
@@ -69,6 +80,7 @@ contains
        pt%attr(5) = i * 6
 
        !$acc loop vector
+       ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
        do j = 0, 31
           arr(i * 32 + j) = arr(i * 32 + j) + pt%x + pt%y + pt%z + pt%attr(5);
        end do
@@ -92,10 +104,14 @@ contains
 
     !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
     !$acc loop gang
+    ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
     do i = 0, 31
        !$acc loop worker
+       ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
        do j = 0, 31
           !$acc loop vector private(pt)
+          ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+          ! { dg-note {variable 'pt' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "TODO" { target *-*-* } .-2 }
           do k = 0, 31
              pt(1) = ieor(i, j * 3)
              pt(2) = ior(i, j * 5)
index f69ab5a..fad3d9d 100644 (file)
@@ -5,6 +5,12 @@
 ! { dg-do run }
 ! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" }
 
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 ! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
 ! aspects of that functionality.
 
@@ -62,6 +68,7 @@ program main
   vectors_max = -huge(gangs_max) - 1 ! INT_MIN
   !$acc serial &
   !$acc   reduction (min: gangs_min, workers_min, vectors_min) reduction (max: gangs_max, workers_max, vectors_max) ! { dg-warning "using vector_length \\(32\\), ignoring 1" "" { target openacc_nvidia_accel_selected } }
+  ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
   do i = 100, -99, -1
      gangs_min = acc_gang ();
      gangs_max = acc_gang ();
@@ -90,6 +97,8 @@ program main
   ! { dg-bogus "\[Ww\]arning: region contains gang partitioned code but is not gang partitioned" "TODO 'serial'" { xfail *-*-* } .-1 }
   ! { dg-bogus "\[Ww\]arning: region contains worker partitioned code but is not worker partitioned" "TODO 'serial'" { xfail *-*-* } .-2 }
   ! { dg-bogus "\[Ww\]arning: region contains vector partitioned code but is not vector partitioned" "TODO 'serial'" { xfail *-*-* } .-3 }
+  ! { dg-note {variable 'C.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } .-4 }
+  !TODO Unhandled 'CONST_DECL' instance for constant argument in 'acc_on_device' call.
   if (acc_on_device (acc_device_nvidia)) then
      ! The GCC nvptx back end enforces vector_length (32).
      ! It's unclear if that's actually permissible here;
@@ -98,10 +107,14 @@ program main
    vectors_actual = 32
   end if
   !$acc loop gang reduction (min: gangs_min, workers_min, vectors_min) reduction (max: gangs_max, workers_max, vectors_max)
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
   do i = 100, -99, -1
      !$acc loop worker reduction (min: gangs_min, workers_min, vectors_min) reduction (max: gangs_max, workers_max, vectors_max)
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+     ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-2 }
      do j = 100, -99, -1
         !$acc loop vector reduction (min: gangs_min, workers_min, vectors_min) reduction (max: gangs_max, workers_max, vectors_max)
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
         do k = 100 * vectors_actual, -99 * vectors_actual, -1
            gangs_min = acc_gang ();
            gangs_max = acc_gang ();
index 81487d7..4be7507 100644 (file)
@@ -1,17 +1,27 @@
-! Test for "oacc gang-private" attribute on gang-private variables
+! 'atomic' access of gang-private variable
 
 ! { dg-do run }
-! { dg-additional-options "-fdump-tree-oaccdevlow-details -w" }
+
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 
 program main
   integer :: w, arr(0:31)
 
   !$acc parallel num_gangs(32) num_workers(32) copyout(arr)
     !$acc loop gang private(w)
-! { dg-final { scan-tree-dump-times "Decl UID \[0-9\]+ has gang partitioning:  integer\\(kind=4\\) w;" 1 "oaccdevlow" } } */
+    ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+    ! { dg-note {variable 'w' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 }
+    ! { dg-note {variable 'w' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } .-3 }
+    ! { dg-note {variable 'w' adjusted for OpenACC privatization level: 'gang'} "" { target { ! openacc_host_selected } } .-4 }
     do j = 0, 31
       w = 0
       !$acc loop seq
+      ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
       do i = 0, 31
         !$acc atomic update
         w = w + 1
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/private-atomic-1-vector.f90 b/libgomp/testsuite/libgomp.oacc-fortran/private-atomic-1-vector.f90
new file mode 100644 (file)
index 0000000..e916837
--- /dev/null
@@ -0,0 +1,42 @@
+! 'atomic' access of vector-private variable
+
+! { dg-do run }
+
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
+
+program main
+  integer :: w, arr(0:31)
+
+  !$acc parallel num_gangs(32) num_workers(32) copyout(arr)
+    !$acc loop gang worker vector private(w)
+    ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+    ! { dg-note {variable 'w' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 }
+    ! { dg-note {variable 'w' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } .-3 }
+    ! { dg-note {variable 'w' adjusted for OpenACC privatization level: 'vector'} "" { target { ! openacc_host_selected } } .-4 }
+    do j = 0, 31
+      w = 0
+      !$acc loop seq
+      ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+      do i = 0, 31
+        !$acc atomic update
+        w = w + 1
+        ! nvptx offloading: PR83812 "operation not supported on global/shared address space".
+        ! { dg-output "(\n|\r\n|\r)libgomp: cuStreamSynchronize error: operation not supported on global/shared address space(\n|\r\n|\r)$" { target openacc_nvidia_accel_selected } }
+        !   Scan for what we expect in the "XFAILed" case (without actually XFAILing).
+        ! { dg-shouldfail "XFAILed" { openacc_nvidia_accel_selected } }
+        !   ... instead of 'dg-xfail-run-if' so that 'dg-output' is evaluated at all.
+        ! { dg-final { if { [dg-process-target { xfail openacc_nvidia_accel_selected }] == "F" } { xfail "[testname-for-summary] really is XFAILed" } } }
+        !   ... so that we still get an XFAIL visible in the log.
+        !$acc end atomic
+      end do
+      arr(j) = w
+    end do
+  !$acc end parallel
+
+  if (any (arr .ne. 32)) stop 1
+end program main
index 21d1375..5fa157b 100644 (file)
@@ -1,17 +1,27 @@
-! Test for worker-private variables
+! 'atomic' access of worker-private variable
 
 ! { dg-do run }
-! { dg-additional-options "-fdump-tree-oaccdevlow-details" }
+
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 
 program main
   integer :: w, arr(0:31)
 
   !$acc parallel num_gangs(32) num_workers(32) copyout(arr)
     !$acc loop gang worker private(w)
-! { dg-final { scan-tree-dump-times "Decl UID \[0-9\]+ has worker partitioning:  integer\\(kind=4\\) w;" 1 "oaccdevlow" } } */
+    ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
+    ! { dg-note {variable 'w' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } .-2 }
+    ! { dg-note {variable 'w' ought to be adjusted for OpenACC privatization level: 'worker'} "" { target *-*-* } .-3 }
+    ! { dg-note {variable 'w' adjusted for OpenACC privatization level: 'worker'} "TODO" { target { ! openacc_host_selected } xfail *-*-* } .-4 }
     do j = 0, 31
       w = 0
       !$acc loop seq
+      ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
       do i = 0, 31
         !$acc atomic update
         w = w + 1
index 81043a2..e40a82f 100644 (file)
@@ -2,9 +2,23 @@
 
 ! { dg-do run }
 
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 ! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
 ! aspects of that functionality.
 
+! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
+! passed to 'incr' may be unset, and in that case, it will be set to [...]",
+! so to maintain compatibility with earlier Tcl releases, we manually
+! initialize counter variables:
+! { dg-line l_dummy[variable c_loop 0] }
+! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
+! "WARNING: dg-line var l_dummy defined, but not used".
+
 
 ! Test of gang-private variables declared on loop directive.
 
@@ -18,7 +32,9 @@ subroutine t1()
   !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
   ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 }
   ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-2 }
-  !$acc loop gang private(x)
+  !$acc loop gang private(x) ! { dg-line l_loop[incr c_loop] }
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+  ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
   do i = 1, 32
      x = i * 2;
      arr(i) = arr(i) + x
@@ -43,11 +59,14 @@ subroutine t2()
 
   !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
   ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 }
-  !$acc loop gang private(x)
+  !$acc loop gang private(x) ! { dg-line l_loop[incr c_loop] }
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+  ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
   do i = 0, 31
      x = i * 2;
 
-     !$acc loop worker
+     !$acc loop worker ! { dg-line l_loop[incr c_loop] }
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
      do j = 0, 31
         arr(i * 32 + j) = arr(i * 32 + j) + x
      end do
@@ -72,11 +91,14 @@ subroutine t3()
 
   !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
   ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 }
-  !$acc loop gang private(x)
+  !$acc loop gang private(x) ! { dg-line l_loop[incr c_loop] }
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+  ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
   do i = 0, 31
      x = i * 2;
 
-     !$acc loop vector
+     !$acc loop vector ! { dg-line l_loop[incr c_loop] }
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
      do j = 0, 31
         arr(i * 32 + j) = arr(i * 32 + j) + x
      end do
@@ -106,14 +128,26 @@ subroutine t4()
 
   !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
   ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 }
-  !$acc loop gang private(pt)
+  !$acc loop gang private(pt) ! { dg-line l_loop[incr c_loop] }
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+  ! { dg-note {variable 'pt' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+  ! But, with optimizations enabled, per the '*.ssa' dump ('gcc/tree-ssa.c:execute_update_addresses_taken'):
+  !     No longer having address taken: pt
+  ! However, 'pt' remains in the candidate set:
+  ! { dg-note {variable 'pt' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_loop$c_loop }
+  ! Now, for GCN offloading, 'adjust_private_decl' does the privatization change right away:
+  ! { dg-note {variable 'pt' adjusted for OpenACC privatization level: 'gang'} "" { target openacc_radeon_accel_selected } l_loop$c_loop }
+  ! For nvptx offloading however, we first mark up 'pt', and then later apply the privatization change -- or, with optimizations enabled, don't, because we then don't actually call 'expand_var_decl'.
+  ! { dg-note {variable 'pt' adjusted for OpenACC privatization level: 'gang'} "" { target { openacc_nvidia_accel_selected && { ! __OPTIMIZE__ } } } l_loop$c_loop }
+  ! { dg-bogus {note: variable 'pt' adjusted for OpenACC privatization level: 'gang'} "" { target { openacc_nvidia_accel_selected && __OPTIMIZE__ } } l_loop$c_loop }
   do i = 0, 31
      pt%x = i
      pt%y = i * 2
      pt%z = i * 4
      pt%attr(5) = i * 6
 
-     !$acc loop vector
+     !$acc loop vector ! { dg-line l_loop[incr c_loop] }
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
      do j = 0, 31
         arr(i * 32 + j) = arr(i * 32 + j) + pt%x + pt%y + pt%z + pt%attr(5);
      end do
@@ -136,16 +170,22 @@ subroutine t5()
   end do
 
   !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
-  !$acc loop gang
+  !$acc loop gang ! { dg-line l_loop[incr c_loop] }
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
   do i = 0, 31
-     !$acc loop worker
+     !$acc loop worker ! { dg-line l_loop[incr c_loop] }
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
      do j = 0, 31
-        !$acc loop vector private(x)
+        !$acc loop vector private(x) ! { dg-line l_loop[incr c_loop] }
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+        ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
         do k = 0, 31
            x = ieor(i, j * 3)
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k
         end do
-        !$acc loop vector private(x)
+        !$acc loop vector private(x) ! { dg-line l_loop[incr c_loop] }
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+        ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
         do k = 0, 31
            x = ior(i, j * 5)
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k
@@ -177,11 +217,18 @@ subroutine t6()
   end do
 
   !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
-  !$acc loop gang
+  !$acc loop gang ! { dg-line l_loop[incr c_loop] }
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
   do i = 0, 31
-     !$acc loop worker
+     !$acc loop worker ! { dg-line l_loop[incr c_loop] }
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
      do j = 0, 31
-        !$acc loop vector private(x, pt)
+        !$acc loop vector private(x, pt) ! { dg-line l_loop[incr c_loop] }
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+        ! { dg-bogus {note: variable 'x' in 'private' clause} "" { target *-*-* } l_loop$c_loop }
+        ! { dg-note {variable 'pt' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+        ! { dg-note {variable 'pt' ought to be adjusted for OpenACC privatization level: 'vector'} "" { target *-*-* } l_loop$c_loop }
+        ! { dg-note {variable 'pt' adjusted for OpenACC privatization level: 'vector'} "" { target { ! openacc_host_selected } } l_loop$c_loop }
         do k = 0, 31
            pt(1) = ieor(i, j * 3)
            pt(2) = ior(i, j * 5)
@@ -217,9 +264,13 @@ subroutine t7()
 
   !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
   ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 }
-  !$acc loop gang private(x)
+  !$acc loop gang private(x) ! { dg-line l_loop[incr c_loop] }
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+  ! { dg-bogus {note: variable 'x' in 'private' clause} "" { target *-*-* } l_loop$c_loop }
   do i = 0, 31
-     !$acc loop worker private(x)
+     !$acc loop worker private(x) ! { dg-line l_loop[incr c_loop] }
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+     ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
      do j = 0, 31
         x = ieor(i, j * 3)
         arr(i * 32 + j) = arr(i * 32 + j) + x
@@ -244,13 +295,17 @@ subroutine t8()
   end do
 
   !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
-  !$acc loop gang
+  !$acc loop gang ! { dg-line l_loop[incr c_loop] }
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
   do i = 0, 31
-     !$acc loop worker private(x)
+     !$acc loop worker private(x) ! { dg-line l_loop[incr c_loop] }
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+     ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
      do j = 0, 31
         x = ieor(i, j * 3)
 
-        !$acc loop vector
+        !$acc loop vector ! { dg-line l_loop[incr c_loop] }
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k
         end do
@@ -280,23 +335,30 @@ subroutine t9()
   end do
 
   !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
-  !$acc loop gang
+  !$acc loop gang ! { dg-line l_loop[incr c_loop] }
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
   do i = 0, 31
-     !$acc loop worker private(x)
+     !$acc loop worker private(x) ! { dg-line l_loop[incr c_loop] }
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+     ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
      do j = 0, 31
         x = ieor(i, j * 3)
 
-        !$acc loop vector
+        !$acc loop vector ! { dg-line l_loop[incr c_loop] }
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k
         end do
      end do
 
-     !$acc loop worker private(x)
+     !$acc loop worker private(x) ! { dg-line l_loop[incr c_loop] }
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+     ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
      do j = 0, 31
         x = ior(i, j * 5)
 
-        !$acc loop vector
+        !$acc loop vector ! { dg-line l_loop[incr c_loop] }
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k
         end do
@@ -328,20 +390,25 @@ subroutine t10()
   end do
 
   !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
-  !$acc loop gang
+  !$acc loop gang ! { dg-line l_loop[incr c_loop] }
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
   do i = 0, 31
-     !$acc loop worker private(x)
+     !$acc loop worker private(x) ! { dg-line l_loop[incr c_loop] }
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+     ! { dg-note {variable 'x' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
      do j = 0, 31
         x = ieor(i, j * 3)
 
-        !$acc loop vector
+        !$acc loop vector ! { dg-line l_loop[incr c_loop] }
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k
         end do
 
         x = ior(i, j * 5)
 
-        !$acc loop vector
+        !$acc loop vector ! { dg-line l_loop[incr c_loop] }
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k
         end do
@@ -375,21 +442,29 @@ subroutine t11()
   end do
 
   !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
-  !$acc loop gang
+  !$acc loop gang ! { dg-line l_loop[incr c_loop] }
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
   do i = 0, 31
-     !$acc loop worker private(x, p)
+     !$acc loop worker private(x, p) ! { dg-line l_loop[incr c_loop] }
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+     ! { dg-note {variable 'x' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+     ! { dg-note {variable 'x' ought to be adjusted for OpenACC privatization level: 'worker'} "" { target *-*-* } l_loop$c_loop }
+     ! { dg-note {variable 'x' adjusted for OpenACC privatization level: 'worker'} "TODO" { target { ! openacc_host_selected } xfail *-*-* } l_loop$c_loop }
+     ! { dg-note {variable 'p' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
      do j = 0, 31
         p => x
         x = ieor(i, j * 3)
 
-        !$acc loop vector
+        !$acc loop vector ! { dg-line l_loop[incr c_loop] }
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k
         end do
 
         p = ior(i, j * 5)
 
-        !$acc loop vector
+        !$acc loop vector ! { dg-line l_loop[incr c_loop] }
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + x * k
         end do
@@ -426,19 +501,24 @@ subroutine t12()
   end do
 
   !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
-  !$acc loop gang
+  !$acc loop gang ! { dg-line l_loop[incr c_loop] }
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
   do i = 0, 31
-     !$acc loop worker private(pt)
+     !$acc loop worker private(pt) ! { dg-line l_loop[incr c_loop] }
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+     ! { dg-note {variable 'pt' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
      do j = 0, 31
         pt%x = ieor(i, j * 3)
         pt%y = ior(i, j * 5)
         
-        !$acc loop vector
+        !$acc loop vector ! { dg-line l_loop[incr c_loop] }
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + pt%x * k
         end do
 
-        !$acc loop vector
+        !$acc loop vector ! { dg-line l_loop[incr c_loop] }
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + pt%y * k
         end do
@@ -470,19 +550,26 @@ subroutine t13()
   end do
 
   !$acc parallel copy(arr) num_gangs(32) num_workers(8) vector_length(32)
-  !$acc loop gang
+  !$acc loop gang ! { dg-line l_loop[incr c_loop] }
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
   do i = 0, 31
-     !$acc loop worker private(pt)
+     !$acc loop worker private(pt) ! { dg-line l_loop[incr c_loop] }
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+     ! { dg-note {variable 'pt' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+     ! { dg-note {variable 'pt' ought to be adjusted for OpenACC privatization level: 'worker'} "" { target *-*-* } l_loop$c_loop }
+     ! { dg-note {variable 'pt' adjusted for OpenACC privatization level: 'worker'} "TODO" { target { ! openacc_host_selected } xfail *-*-* } l_loop$c_loop } */
      do j = 0, 31
         pt(1) = ieor(i, j * 3)
         pt(2) = ior(i, j * 5)
         
-        !$acc loop vector
+        !$acc loop vector ! { dg-line l_loop[incr c_loop] }
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + pt(1) * k
         end do
 
-        !$acc loop vector
+        !$acc loop vector ! { dg-line l_loop[incr c_loop] }
+        ! { dg-note {variable 'k' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
         do k = 0, 31
            arr(i * 1024 + j * 32 + k) = arr(i * 1024 + j * 32 + k) + pt(2) * k
         end do
@@ -518,13 +605,17 @@ subroutine t14()
   !$acc parallel private(x) copy(arr) num_gangs(n) num_workers(8) vector_length(32)
   ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-1 }
   ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-2 }
-    !$acc loop gang(static:1)
+    !$acc loop gang(static:1) ! { dg-line l_loop[incr c_loop] }
+    ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
     do i = 1, n
       x = i * 2;
     end do
 
-   !$acc loop gang(static:1)
+   !$acc loop gang(static:1) ! { dg-line l_loop[incr c_loop] }
+    ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
     do i = 1, n
+       ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } l_loop$c_loop }
+       !TODO Unhandled 'CONST_DECL' instance for constant argument in 'acc_on_device' call.
       if (acc_on_device (acc_device_host) .eqv. .TRUE.) x = i * 2
       arr(i) = arr(i) + x
     end do
index 907f024..ba638da 100644 (file)
@@ -7,6 +7,20 @@
 ! XFAIL the "UNRESOLVED: [...] compilation failed to produce executable", or
 ! get rid of it, unfortunately.
 
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
+! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
+! passed to 'incr' may be unset, and in that case, it will be set to [...]",
+! so to maintain compatibility with earlier Tcl releases, we manually
+! initialize counter variables:
+! { dg-line l_dummy[variable c_compute 0 c_loop 0] }
+! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid
+! "WARNING: dg-line var l_dummy defined, but not used".  */
+
 program main
   implicit none (type, external)
   integer :: j
@@ -28,10 +42,18 @@ contains
     integer :: i, nn
     integer :: array(nn)
 
-    !$acc parallel copyout(array)
+    !$acc parallel copyout(array) ! { dg-line l_compute[incr c_compute] }
+    ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'atmp\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'shadow_loopvar\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'offset\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'S\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'test\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     array = [(-i, i = 1, nn)]
-    !$acc loop gang private(array)
-    ! { dg-message {sorry, unimplemented: target cannot support alloca} PR65181 { target openacc_nvidia_accel_selected } .-1 }
+    !$acc loop gang private(array) ! { dg-line l_loop[incr c_loop] }
+    ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'array' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-message {sorry, unimplemented: target cannot support alloca} PR65181 { target openacc_nvidia_accel_selected } l_loop$c_loop }
     do i = 1, 10
       array(i) = i
     end do
@@ -42,10 +64,26 @@ contains
     integer :: i
     integer :: array(:)
 
-    !$acc parallel copyout(array)
+    !$acc parallel copyout(array) ! { dg-line l_compute[incr c_compute] }
+    ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'atmp\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'shadow_loopvar\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'offset\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'S\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'test\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'parm\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'parm\.[0-9]+' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'parm\.[0-9]+' adjusted for OpenACC privatization level: 'gang'} "" { target { ! { openacc_host_selected || openacc_nvidia_accel_selected } } } l_compute$c_compute }
+    ! { dg-note {variable 'A\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'A\.[0-9]+' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_compute$c_compute }
+    ! { dg-note {variable 'A\.[0-9]+' adjusted for OpenACC privatization level: 'gang'} "" { target { ! { openacc_host_selected || openacc_nvidia_accel_selected } } } l_compute$c_compute }
     array = [(-2*i, i = 1, size(array))]
-    !$acc loop gang private(array)
-    ! { dg-message {sorry, unimplemented: target cannot support alloca} PR65181 { target openacc_nvidia_accel_selected } .-1 }
+    !$acc loop gang private(array) ! { dg-line l_loop[incr c_loop] }
+    ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'array\.[0-9]+' in 'private' clause is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'array\.[0-9]+' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'array\.[0-9]+' adjusted for OpenACC privatization level: 'gang'} "" { target { ! { openacc_host_selected || openacc_nvidia_accel_selected } } } l_loop$c_loop }
+    ! { dg-message {sorry, unimplemented: target cannot support alloca} PR65181 { target openacc_nvidia_accel_selected } l_loop$c_loop }
     do i = 1, 10
       array(i) = 9*i
     end do
@@ -56,10 +94,17 @@ contains
     integer :: i
     character(len=*) :: str
 
-    !$acc parallel copyout(str)
+    !$acc parallel copyout(str) ! { dg-line l_compute[incr c_compute] }
+    ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_compute$c_compute }
     str = "abcdefghij"
-    !$acc loop gang private(str)
-    ! { dg-message {sorry, unimplemented: target cannot support alloca} PR65181 { target openacc_nvidia_accel_selected } .-1 }
+    !$acc loop gang private(str) ! { dg-line l_loop[incr c_loop] }
+    ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'str' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'char\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'char\.[0-9]+' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'char\.[0-9]+' adjusted for OpenACC privatization level: 'gang'} "" { target { ! { openacc_host_selected || openacc_nvidia_accel_selected } } } l_loop$c_loop }
+    ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-message {sorry, unimplemented: target cannot support alloca} PR65181 { target openacc_nvidia_accel_selected } l_loop$c_loop }
     do i = 1, 10
       str(i:i) = achar(ichar('A') + i)
     end do
@@ -88,7 +133,13 @@ contains
 
     !$acc parallel copyout(scalar)
     scalar = "abcdefghi-12345"
-    !$acc loop gang private(scalar)
+    !$acc loop gang private(scalar) ! { dg-line l_loop[incr c_loop] }
+    ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'scalar' in 'private' clause potentially has improper OpenACC privatization level: 'parm_decl'} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'char\.[0-9]+' declared in block is candidate for adjusting OpenACC privatization level} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'char\.[0-9]+' ought to be adjusted for OpenACC privatization level: 'gang'} "" { target *-*-* } l_loop$c_loop }
+    ! { dg-note {variable 'char\.[0-9]+' adjusted for OpenACC privatization level: 'gang'} "" { target { ! { openacc_host_selected || openacc_nvidia_accel_selected } } } l_loop$c_loop }
+    ! { dg-note {variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } l_loop$c_loop }
     do i = 1, 15
       scalar(i:i) = achar(ichar('A') + i)
     end do
index c34de3a..75660bb 100644 (file)
@@ -2,6 +2,12 @@
 ! { dg-do run }
 ! { dg-additional-options "-cpp" }
 
+! { dg-additional-options "-fopt-info-note-omp" }
+! { dg-additional-options "--param=openacc-privatization=noisy" }
+! { dg-additional-options "-foffload=-fopt-info-note-omp" }
+! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
+! for testing/documenting aspects of that functionality.
+
 ! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
 ! aspects of that functionality.
 !TODO { dg-additional-options "-fno-inline" } for stable results regarding OpenACC 'routine'.
@@ -20,6 +26,7 @@ program main
 
   !$acc parallel copy (a)
   !$acc loop seq
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
     do i = 1, N
       call seq (a)
     end do
@@ -31,6 +38,7 @@ program main
 
   !$acc parallel copy (a)
   !$acc loop seq
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
     do i = 1, N 
       call gang (a)
     end do
@@ -46,6 +54,7 @@ program main
 
   !$acc parallel copy (b)
   !$acc loop seq
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
     do i = 1, N
       call worker (b)
     end do
@@ -61,6 +70,7 @@ program main
 
   !$acc parallel copy (a)
   !$acc loop seq
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
     do i = 1, N
       call vector (a)
     end do
@@ -78,6 +88,7 @@ subroutine vector (a)
   integer :: i
 
   !$acc loop vector
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
   do i = 1, N
     a(i) = a(i) - a(i) 
   end do
@@ -90,8 +101,10 @@ subroutine worker (b)
   integer :: i, j
 
   !$acc loop worker
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
   do i = 1, N
   !$acc loop vector
+     ! { dg-note {variable 'j' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
     do j = 1, M
       b(j + ((i - 1) * M)) = b(j + ((i - 1) * M)) + 1
     end do
@@ -107,6 +120,7 @@ subroutine gang (a)
   integer :: i
 
   !$acc loop gang
+  ! { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} "" { target *-*-* } .-1 }
   do i = 1, N
     a(i) = a(i) - i 
   end do