re PR middle-end/28046 (libgomp test pr27337.C fails intermittently)
PR middle-end/28046 * c-omp.c (c_finish_omp_atomic): If ADDR is not simple enough, wrap it into TARGET_EXPR. * gcc.dg/gomp/atomic-10.c: New test. * g++.dg/gomp/atomic-10.C: New test. From-SVN: r117077
This commit is contained in:
parent
1e993cb82d
commit
66bb4f322e
5 changed files with 69 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
2006-09-20 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/28046
|
||||
* c-omp.c (c_finish_omp_atomic): If ADDR is not simple enough,
|
||||
wrap it into TARGET_EXPR.
|
||||
|
||||
2006-09-20 Eric Christopher <echristo@apple.com>
|
||||
|
||||
* config/i386/i386.c (x86_fisttp): Remove.
|
||||
|
|
|
@ -116,6 +116,15 @@ c_finish_omp_atomic (enum tree_code code, tree lhs, tree rhs)
|
|||
if (addr == error_mark_node)
|
||||
return error_mark_node;
|
||||
addr = save_expr (addr);
|
||||
if (TREE_CODE (addr) != SAVE_EXPR
|
||||
&& (TREE_CODE (addr) != ADDR_EXPR
|
||||
|| TREE_CODE (TREE_OPERAND (addr, 0)) != VAR_DECL))
|
||||
{
|
||||
/* Make sure LHS is simple enough so that goa_lhs_expr_p can recognize
|
||||
it even after unsharing function body. */
|
||||
tree var = create_tmp_var_raw (TREE_TYPE (addr), NULL);
|
||||
addr = build4 (TARGET_EXPR, TREE_TYPE (addr), var, addr, NULL, NULL);
|
||||
}
|
||||
lhs = build_indirect_ref (addr, NULL);
|
||||
|
||||
/* There are lots of warnings, errors, and conversions that need to happen
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2006-09-20 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/28046
|
||||
* gcc.dg/gomp/atomic-10.c: New test.
|
||||
* g++.dg/gomp/atomic-10.C: New test.
|
||||
|
||||
2006-09-20 Eric Christopher <echristo@apple.com>
|
||||
|
||||
* gcc.target/i386/sse3-not-fisttp.c: New.
|
||||
|
|
24
gcc/testsuite/g++.dg/gomp/atomic-10.C
Normal file
24
gcc/testsuite/g++.dg/gomp/atomic-10.C
Normal file
|
@ -0,0 +1,24 @@
|
|||
// PR middle-end/28046
|
||||
// { dg-do compile }
|
||||
// { dg-options "-fopenmp -fdump-tree-gimple" }
|
||||
|
||||
int a[3], b;
|
||||
struct C { int x; int y; } c;
|
||||
|
||||
int bar (void), *baz (void);
|
||||
|
||||
void
|
||||
foo (void)
|
||||
{
|
||||
#pragma omp atomic
|
||||
a[2] += bar ();
|
||||
#pragma omp atomic
|
||||
b += bar ();
|
||||
#pragma omp atomic
|
||||
c.y += bar ();
|
||||
#pragma omp atomic
|
||||
*baz () += bar ();
|
||||
}
|
||||
|
||||
// { dg-final { scan-tree-dump-times "__sync_fetch_and_add" 4 "gimple" { target i?86-*-* x86_64-*-* ia64-*-* powerpc*-*-* alpha*-*-* } } }
|
||||
// { dg-final { cleanup-tree-dump "gimple" } }
|
24
gcc/testsuite/gcc.dg/gomp/atomic-10.c
Normal file
24
gcc/testsuite/gcc.dg/gomp/atomic-10.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
/* PR middle-end/28046 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-fopenmp -fdump-tree-gimple" } */
|
||||
|
||||
int a[3], b;
|
||||
struct C { int x; int y; } c;
|
||||
|
||||
int bar (void), *baz (void);
|
||||
|
||||
void
|
||||
foo (void)
|
||||
{
|
||||
#pragma omp atomic
|
||||
a[2] += bar ();
|
||||
#pragma omp atomic
|
||||
b += bar ();
|
||||
#pragma omp atomic
|
||||
c.y += bar ();
|
||||
#pragma omp atomic
|
||||
*baz () += bar ();
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump-times "__sync_fetch_and_add" 4 "gimple" { target i?86-*-* x86_64-*-* ia64-*-* powerpc*-*-* alpha*-*-* } } } */
|
||||
/* { dg-final { cleanup-tree-dump "gimple" } } */
|
Loading…
Add table
Reference in a new issue