Upstream-Status: Inappropriate [Backport] From 3a3d51cb4f1ec33265471b03d21b96d30e899858 Mon Sep 17 00:00:00 2001 From: jakub Date: Fri, 22 Apr 2011 14:11:44 +0000 Subject: [PATCH 166/200] PR c/48716 * gimplify.c (gimplify_bind_expr): Mark as GOVD_LOCAL also TREE_STATIC variables declared inside of some OpenMP construct. * gcc.dg/gomp/pr48716.c: New test. * g++.dg/gomp/pr48716.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@172860 138bc75d-0d04-0410-961f-82ee72b054a4 index 400493f..908d736 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1138,7 +1138,7 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p) struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp; /* Mark variable as local. */ - if (ctx && !is_global_var (t) + if (ctx && !DECL_EXTERNAL (t) && (! DECL_SEEN_IN_BIND_EXPR_P (t) || splay_tree_lookup (ctx->variables, (splay_tree_key) t) == NULL)) new file mode 100644 index 0000000..2dccad2 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr48716.C @@ -0,0 +1,24 @@ +// PR c/48716 +// { dg-do compile } +// { dg-options "-fopenmp" } + +int +main (void) +{ + #pragma omp parallel default(none) + { + static int s; + int t = 0; + #pragma omp atomic + s++; + t++; + } + #pragma omp task default(none) + { + static int s; + int t = 0; + #pragma omp atomic + s++; + t++; + } +} diff --git a/gcc/testsuite/gcc.dg/gomp/pr48716.c b/gcc/testsuite/gcc.dg/gomp/pr48716.c new file mode 100644 index 0000000..3496e2f --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr48716.c @@ -0,0 +1,24 @@ +/* PR c/48716 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +int +main (void) +{ + #pragma omp parallel default(none) + { + static int s; + int t = 0; + #pragma omp atomic + s++; + t++; + } + #pragma omp task default(none) + { + static int s; + int t = 0; + #pragma omp atomic + s++; + t++; + } +} -- 1.7.0.4