Commit b17a8b07 by Thomas Schwinge Committed by Thomas Schwinge

The error_mark_node is not an OpenMP mappable type.

	gcc/
	* langhooks.c (lhd_omp_mappable_type): The error_mark_node is not
	an OpenMP mappable type.
	gcc/c/
	* c-decl.c (c_decl_attributes): Use
	lang_hooks.types.omp_mappable_type.
	* c-typeck.c (c_finish_omp_clauses): Likewise.
	gcc/testsuite/
	* c-c++-common/gomp/map-1.c: Extend.

From-SVN: r208394
parent c5604b48
2014-03-07 Thomas Schwinge <thomas@codesourcery.com>
* langhooks.c (lhd_omp_mappable_type): The error_mark_node is not
an OpenMP mappable type.
2014-03-06 Matthias Klose <doko@ubuntu.com> 2014-03-06 Matthias Klose <doko@ubuntu.com>
* Makefile.in (s-mlib): Only pass MULTIARCH_DIRNAME if * Makefile.in (s-mlib): Only pass MULTIARCH_DIRNAME if
......
2014-03-07 Thomas Schwinge <thomas@codesourcery.com>
* c-decl.c (c_decl_attributes): Use
lang_hooks.types.omp_mappable_type.
* c-typeck.c (c_finish_omp_clauses): Likewise.
2014-03-06 Marek Polacek <polacek@redhat.com> 2014-03-06 Marek Polacek <polacek@redhat.com>
PR c/60197 PR c/60197
......
...@@ -4024,7 +4024,7 @@ c_decl_attributes (tree *node, tree attributes, int flags) ...@@ -4024,7 +4024,7 @@ c_decl_attributes (tree *node, tree attributes, int flags)
error ("%q+D in block scope inside of declare target directive", error ("%q+D in block scope inside of declare target directive",
*node); *node);
else if (TREE_CODE (*node) == VAR_DECL else if (TREE_CODE (*node) == VAR_DECL
&& !COMPLETE_TYPE_P (TREE_TYPE (*node))) && !lang_hooks.types.omp_mappable_type (TREE_TYPE (*node)))
error ("%q+D in declare target directive does not have mappable type", error ("%q+D in declare target directive does not have mappable type",
*node); *node);
else else
......
...@@ -12032,7 +12032,7 @@ c_finish_omp_clauses (tree clauses) ...@@ -12032,7 +12032,7 @@ c_finish_omp_clauses (tree clauses)
else else
{ {
t = OMP_CLAUSE_DECL (c); t = OMP_CLAUSE_DECL (c);
if (!COMPLETE_TYPE_P (TREE_TYPE (t))) if (!lang_hooks.types.omp_mappable_type (TREE_TYPE (t)))
{ {
error_at (OMP_CLAUSE_LOCATION (c), error_at (OMP_CLAUSE_LOCATION (c),
"array section does not have mappable type " "array section does not have mappable type "
...@@ -12061,9 +12061,9 @@ c_finish_omp_clauses (tree clauses) ...@@ -12061,9 +12061,9 @@ c_finish_omp_clauses (tree clauses)
} }
else if (!c_mark_addressable (t)) else if (!c_mark_addressable (t))
remove = true; remove = true;
else if (!COMPLETE_TYPE_P (TREE_TYPE (t)) else if (!(OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
&& !(OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP && OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER)
&& OMP_CLAUSE_MAP_KIND (c) == OMP_CLAUSE_MAP_POINTER)) && !lang_hooks.types.omp_mappable_type (TREE_TYPE (t)))
{ {
error_at (OMP_CLAUSE_LOCATION (c), error_at (OMP_CLAUSE_LOCATION (c),
"%qD does not have a mappable type in %qs clause", t, "%qD does not have a mappable type in %qs clause", t,
......
...@@ -524,13 +524,15 @@ lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *c ATTRIBUTE_UNUSED, ...@@ -524,13 +524,15 @@ lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *c ATTRIBUTE_UNUSED,
{ {
} }
/* Return true if TYPE is an OpenMP mappable type. By default return true /* Return true if TYPE is an OpenMP mappable type. */
if type is complete. */
bool bool
lhd_omp_mappable_type (tree type) lhd_omp_mappable_type (tree type)
{ {
return COMPLETE_TYPE_P (type); /* Mappable type has to be complete. */
if (type == error_mark_node || !COMPLETE_TYPE_P (type))
return false;
return true;
} }
/* Common function for add_builtin_function and /* Common function for add_builtin_function and
......
2014-03-07 Thomas Schwinge <thomas@codesourcery.com>
* c-c++-common/gomp/map-1.c: Extend.
2014-03-06 Paul Thomas <pault@gcc.gnu.org> 2014-03-06 Paul Thomas <pault@gcc.gnu.org>
Janus Weil <janus@gcc.gnu.org> Janus Weil <janus@gcc.gnu.org>
......
...@@ -8,6 +8,8 @@ int k[10], l[10], m[10], n[10], o; ...@@ -8,6 +8,8 @@ int k[10], l[10], m[10], n[10], o;
int *p; int *p;
int **q; int **q;
int r[4][4][4][4][4]; int r[4][4][4][4][4];
extern struct s s1;
extern struct s s2[1]; /* { dg-error "array type has incomplete element type" "" { target c } } */
int t[10]; int t[10];
#pragma omp threadprivate (t) #pragma omp threadprivate (t)
#pragma omp declare target #pragma omp declare target
...@@ -32,6 +34,10 @@ foo (int g[3][10], int h[4][8], int i[2][10], int j[][9], ...@@ -32,6 +34,10 @@ foo (int g[3][10], int h[4][8], int i[2][10], int j[][9],
; ;
#pragma omp target map(to: o[2:5]) /* { dg-error "does not have pointer or array type" } */ #pragma omp target map(to: o[2:5]) /* { dg-error "does not have pointer or array type" } */
; ;
#pragma omp target map(alloc: s1) /* { dg-error "'s1' does not have a mappable type in 'map' clause" } */
;
#pragma omp target map(alloc: s2) /* { dg-error "'s2' does not have a mappable type in 'map' clause" } */
;
#pragma omp target map(to: a[:][:]) /* { dg-error "array type length expression must be specified" } */ #pragma omp target map(to: a[:][:]) /* { dg-error "array type length expression must be specified" } */
bar (&a[0][0]); /* { dg-error "referenced in target region does not have a mappable type" } */ bar (&a[0][0]); /* { dg-error "referenced in target region does not have a mappable type" } */
#pragma omp target map(tofrom: b[-1:]) /* { dg-error "negative low bound in array section" } */ #pragma omp target map(tofrom: b[-1:]) /* { dg-error "negative low bound in array section" } */
......
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