mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-19 15:11:08 +08:00
re PR middle-end/39154 (Miscompilation of VLAs in nested parallel regions)
PR middle-end/39154 * gimplify.c (omp_notice_variable): If adding GOVD_SEEN bit to variable length decl's flags, add it also to its pointer replacement variable. * testsuite/libgomp.c/pr39154.c: New test. From-SVN: r144111
This commit is contained in:
parent
b058b75355
commit
3ad6b2669b
@ -1,3 +1,10 @@
|
||||
2009-02-11 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/39154
|
||||
* gimplify.c (omp_notice_variable): If adding GOVD_SEEN
|
||||
bit to variable length decl's flags, add it also to its
|
||||
pointer replacement variable.
|
||||
|
||||
2009-02-11 Uros Bizjak <ubizjak@gmail.com>
|
||||
Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
|
@ -5308,6 +5308,20 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code)
|
||||
goto do_outer;
|
||||
}
|
||||
|
||||
if ((n->value & (GOVD_SEEN | GOVD_LOCAL)) == 0
|
||||
&& (flags & (GOVD_SEEN | GOVD_LOCAL)) == GOVD_SEEN
|
||||
&& DECL_SIZE (decl)
|
||||
&& TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
|
||||
{
|
||||
splay_tree_node n2;
|
||||
tree t = DECL_VALUE_EXPR (decl);
|
||||
gcc_assert (TREE_CODE (t) == INDIRECT_REF);
|
||||
t = TREE_OPERAND (t, 0);
|
||||
gcc_assert (DECL_P (t));
|
||||
n2 = splay_tree_lookup (ctx->variables, (splay_tree_key) t);
|
||||
n2->value |= GOVD_SEEN;
|
||||
}
|
||||
|
||||
shared = ((flags | n->value) & GOVD_SHARED) != 0;
|
||||
ret = lang_hooks.decls.omp_disregard_value_expr (decl, shared);
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2009-02-11 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/39154
|
||||
* testsuite/libgomp.c/pr39154.c: New test.
|
||||
|
||||
2009-01-30 Ian Lance Taylor <iant@google.com>
|
||||
|
||||
* acinclude.m4 (LIBCOMP_CHECK_LINKER_FEATURES): Set
|
||||
|
105
libgomp/testsuite/libgomp.c/pr39154.c
Normal file
105
libgomp/testsuite/libgomp.c/pr39154.c
Normal file
@ -0,0 +1,105 @@
|
||||
/* PR middle-end/39154 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -std=gnu99" } */
|
||||
|
||||
extern void abort (void);
|
||||
|
||||
int n = 20;
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
int a[n], b[n][n];
|
||||
|
||||
#pragma omp parallel for
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
a[i] = i + 1;
|
||||
#pragma omp parallel for
|
||||
for (int j = 0; j < n; j++)
|
||||
b[i][j] = a[i];
|
||||
}
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
for (int j = 0; j < n; j++)
|
||||
if (b[i][j] != i + 1)
|
||||
abort ();
|
||||
if (a[i] != i + 1)
|
||||
abort ();
|
||||
}
|
||||
|
||||
#pragma omp parallel for shared (n, a, b)
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
a[i] = i + 3;
|
||||
#pragma omp parallel for
|
||||
for (int j = 0; j < n; j++)
|
||||
b[i][j] = a[i];
|
||||
}
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
for (int j = 0; j < n; j++)
|
||||
if (b[i][j] != i + 3)
|
||||
abort ();
|
||||
if (a[i] != i + 3)
|
||||
abort ();
|
||||
}
|
||||
|
||||
#pragma omp parallel for
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
a[i] = i + 5;
|
||||
#pragma omp parallel for shared (n, a, b)
|
||||
for (int j = 0; j < n; j++)
|
||||
b[i][j] = a[i];
|
||||
}
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
for (int j = 0; j < n; j++)
|
||||
if (b[i][j] != i + 5)
|
||||
abort ();
|
||||
if (a[i] != i + 5)
|
||||
abort ();
|
||||
}
|
||||
|
||||
#pragma omp parallel for shared (n, a, b)
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
a[i] = i + 7;
|
||||
#pragma omp parallel for shared (n, a, b)
|
||||
for (int j = 0; j < n; j++)
|
||||
b[i][j] = a[i];
|
||||
}
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
for (int j = 0; j < n; j++)
|
||||
if (b[i][j] != i + 7)
|
||||
abort ();
|
||||
if (a[i] != i + 7)
|
||||
abort ();
|
||||
}
|
||||
|
||||
#pragma omp parallel for private (a, b)
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
a[i] = i + 1;
|
||||
#pragma omp parallel for
|
||||
for (int j = 0; j < n; j++)
|
||||
b[i][j] = a[i];
|
||||
}
|
||||
|
||||
#pragma omp parallel for private (a, b)
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
a[i] = i + 1;
|
||||
#pragma omp parallel for private (b)
|
||||
for (int j = 0; j < n; j++)
|
||||
b[i][j] = a[i];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user