Commit 85b20612 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/35337 (Broken diagnostic for firstprivate clause)

	PR c++/35337
	* semantics.c (finish_omp_clauses): Use %qD instead of %qE for
	DECL_P in not a variable and appears more than once error messages.

	* g++.dg/gomp/pr35337.C: New test.

From-SVN: r133086
parent 5df27e4a
2008-03-10 Jakub Jelinek <jakub@redhat.com>
PR c++/35337
* semantics.c (finish_omp_clauses): Use %qD instead of %qE for
DECL_P in not a variable and appears more than once error messages.
2008-03-07 Paolo Bonzini <bonzini@gnu.org> 2008-03-07 Paolo Bonzini <bonzini@gnu.org>
Revert: Revert:
......
...@@ -3400,13 +3400,16 @@ finish_omp_clauses (tree clauses) ...@@ -3400,13 +3400,16 @@ finish_omp_clauses (tree clauses)
{ {
if (processing_template_decl) if (processing_template_decl)
break; break;
if (DECL_P (t))
error ("%qD is not a variable in clause %<firstprivate%>", t);
else
error ("%qE is not a variable in clause %<firstprivate%>", t); error ("%qE is not a variable in clause %<firstprivate%>", t);
remove = true; remove = true;
} }
else if (bitmap_bit_p (&generic_head, DECL_UID (t)) else if (bitmap_bit_p (&generic_head, DECL_UID (t))
|| bitmap_bit_p (&firstprivate_head, DECL_UID (t))) || bitmap_bit_p (&firstprivate_head, DECL_UID (t)))
{ {
error ("%qE appears more than once in data clauses", t); error ("%qD appears more than once in data clauses", t);
remove = true; remove = true;
} }
else else
...@@ -3419,13 +3422,16 @@ finish_omp_clauses (tree clauses) ...@@ -3419,13 +3422,16 @@ finish_omp_clauses (tree clauses)
{ {
if (processing_template_decl) if (processing_template_decl)
break; break;
if (DECL_P (t))
error ("%qD is not a variable in clause %<lastprivate%>", t);
else
error ("%qE is not a variable in clause %<lastprivate%>", t); error ("%qE is not a variable in clause %<lastprivate%>", t);
remove = true; remove = true;
} }
else if (bitmap_bit_p (&generic_head, DECL_UID (t)) else if (bitmap_bit_p (&generic_head, DECL_UID (t))
|| bitmap_bit_p (&lastprivate_head, DECL_UID (t))) || bitmap_bit_p (&lastprivate_head, DECL_UID (t)))
{ {
error ("%qE appears more than once in data clauses", t); error ("%qD appears more than once in data clauses", t);
remove = true; remove = true;
} }
else else
......
2008-03-10 Jakub Jelinek <jakub@redhat.com> 2008-03-10 Jakub Jelinek <jakub@redhat.com>
PR c++/35337
* g++.dg/gomp/pr35337.C: New test.
PR c/35438 PR c/35438
PR c/35439 PR c/35439
* gcc.dg/gomp/pr35438.c: New test. * gcc.dg/gomp/pr35438.c: New test.
// PR c++/35337
// { dg-do compile }
// { dg-options "-fopenmp" }
struct A { };
void
foo ()
{
#pragma omp parallel firstprivate(A) // { dg-error "struct A\[^\n\]*is not a variable" }
;
}
void
bar ()
{
#pragma omp for lastprivate(A) // { dg-error "struct A\[^\n\]*is not a variable" }
for (int i = 0; i < 10; i++)
;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment