Jakub,

On 11/06/2015 01:31 PM, Jakub Jelinek wrote:
On Wed, Nov 04, 2015 at 06:32:00AM -0600, James Norris wrote:
+/* Node in the linked list used for storing !$oacc declare constructs.  */
+
+typedef struct gfc_oacc_declare
+{
+  struct gfc_oacc_declare *next;
+  bool module_var;
+  gfc_omp_clauses *clauses;
+  gfc_omp_clauses *return_clauses;
+}
+gfc_oacc_declare;
+
+#define gfc_get_oacc_declare() XCNEW (gfc_oacc_declare)
+
+
  /* Node in the linked list used for storing !$omp declare simd constructs.  */
typedef struct gfc_omp_declare_simd
@@ -1644,7 +1668,7 @@ typedef struct gfc_namespace
    struct gfc_data *data, *old_data;
/* !$ACC DECLARE clauses. */
-  gfc_omp_clauses *oacc_declare_clauses;
+  struct gfc_oacc_declare *oacc_declare_clauses;
This should be renamed now that it doesn't hold just clauses,
perhaps just oacc_declare?  Also, no need to use struct keyword.

That's fine, I'll fix that.


@@ -2857,6 +2957,42 @@ oacc_compatible_clauses (gfc_omp_clauses *clauses, int 
list,
    return false;
  }
+/* Check if a variable appears in multiple clauses. */
+
+static void
+resolve_omp_duplicate_list (gfc_omp_namelist *clause_list, bool openacc,
+                           int list)
+{
+  gfc_omp_namelist *n;
+  const char *error_msg = "Symbol %qs present on multiple clauses at %L";
+
+  /* OpenACC reduction clauses are compatible with everything.  We only
+     need to check if a reduction variable is used more than once.  */
+  if (openacc && list == OMP_LIST_REDUCTION)
+    {
+      hash_set<gfc_symbol *> reductions;
+
+      for (n = clause_list; n; n = n->next)
+       {
+         if (reductions.contains (n->sym))
+           gfc_error (error_msg, n->sym->name, &n->expr->where);
+         else
+           reductions.add (n->sym);
+       }
+
+      return;
+    }
+
+  /* Ensure that variables are only used in one clause.  */
+  for (n = clause_list; n; n = n->next)
+    {
+      if (n->sym->mark)
+       gfc_error (error_msg, n->sym->name, &n->expr->where);
+      else
+       n->sym->mark = 1;
+    }
+}
You are readding a function that has been rejected, OMP_LIST_REDUCTION
is handled differently now.

        Jakub

Okay, I'll fix this.

After fixing, OK to commit?

Thank you for taking the time for the review.

Jim



Reply via email to