This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gomp] fix gcc.dg/gomp/copyin-1.c


The test was written while I was working thruogh the contraints one
by one, but I hadn't gotten around to finishing it.  Fortunately, it
started ICEing, so I was reminded to do so.


r~


        * c-parser.c (c_parser_omp_clause_copyin): Verify that the
        variables are in fact threadprivate.

        * gcc.dg/gomp/copyin-1.c: Add expected error markers.

Index: c-parser.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-parser.c,v
retrieving revision 2.17.4.29
diff -u -p -r2.17.4.29 c-parser.c
--- c-parser.c	9 Oct 2005 01:01:21 -0000	2.17.4.29
+++ c-parser.c	10 Oct 2005 00:32:12 -0000
@@ -6622,7 +6622,22 @@ c_parser_omp_var_list_parens (c_parser *
 static tree
 c_parser_omp_clause_copyin (c_parser *parser, tree list)
 {
-  return c_parser_omp_var_list_parens (parser, OMP_CLAUSE_COPYIN, list);
+  tree nlist, t;
+  bool saw_error = false;
+
+  nlist = c_parser_omp_var_list_parens (parser, OMP_CLAUSE_COPYIN, list);
+
+  for (t = nlist; t != list; t = OMP_CLAUSE_CHAIN (t))
+    {
+      tree decl = OMP_CLAUSE_DECL (t);
+      if (!DECL_THREAD_LOCAL_P (decl))
+	{
+	  error ("%qE used in %<copyin%> is not %<threadprivate%>", decl);
+	  saw_error = true;
+	}
+    }
+
+  return saw_error ? list : nlist;
 }
 
 /* OpenMP 2.5:
Index: testsuite/gcc.dg/gomp/copyin-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/gomp/Attic/copyin-1.c,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 copyin-1.c
--- testsuite/gcc.dg/gomp/copyin-1.c	28 Sep 2005 12:37:12 -0000	1.1.2.1
+++ testsuite/gcc.dg/gomp/copyin-1.c	10 Oct 2005 00:32:13 -0000
@@ -15,11 +15,11 @@ void foo(void)
 
   #pragma omp parallel copyin(i)
     bar();
-  #pragma omp parallel copyin(j)
+  #pragma omp parallel copyin(j)	// { dg-error "threadprivate" }
     bar();
-  #pragma omp parallel copyin(k)
+  #pragma omp parallel copyin(k)	// { dg-error "threadprivate" }
     bar();
-  #pragma omp parallel copyin(l)
+  #pragma omp parallel copyin(l)	// { dg-error "threadprivate" }
     bar();
   #pragma omp parallel copyin(m)
     bar();


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]