aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index f680292..9163dcd 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -7369,6 +7369,18 @@ omp_default_clause (struct gimplify_omp_ctx *ctx, tree decl,
default_kind = kind;
else if (VAR_P (decl) && TREE_STATIC (decl) && DECL_IN_CONSTANT_POOL (decl))
default_kind = OMP_CLAUSE_DEFAULT_SHARED;
+ /* For C/C++ default({,first}private), variables with static storage duration
+ declared in a namespace or global scope and referenced in construct
+ must be explicitly specified, i.e. acts as default(none). */
+ else if ((default_kind == OMP_CLAUSE_DEFAULT_PRIVATE
+ || default_kind == OMP_CLAUSE_DEFAULT_FIRSTPRIVATE)
+ && VAR_P (decl)
+ && is_global_var (decl)
+ && (DECL_FILE_SCOPE_P (decl)
+ || (DECL_CONTEXT (decl)
+ && TREE_CODE (DECL_CONTEXT (decl)) == NAMESPACE_DECL))
+ && !lang_GNU_Fortran ())
+ default_kind = OMP_CLAUSE_DEFAULT_NONE;
switch (default_kind)
{