diff options
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/gimplify.c | 18 | ||||
-rw-r--r-- | libgomp/ChangeLog | 5 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.fortran/pr34020.f90 | 19 |
4 files changed, 44 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ac0e088..2edefc6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2007-11-10 Jakub Jelinek <jakub@redhat.com> + PR fortran/34020 + * gimplify.c (goa_lhs_expr_p): Inside INDIRECT_REF handle unshared + nops. + PR middle-end/34018 * tree-inline.h (copy_body_data): Add regimplify field. * tree-inline.c (copy_body_r): Set id->regimplify to true diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 5c11bad..212a9dc 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -5291,8 +5291,22 @@ goa_lhs_expr_p (tree expr, tree addr) == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (expr, 0))))) expr = TREE_OPERAND (expr, 0); - if (TREE_CODE (expr) == INDIRECT_REF && TREE_OPERAND (expr, 0) == addr) - return true; + if (TREE_CODE (expr) == INDIRECT_REF) + { + expr = TREE_OPERAND (expr, 0); + while (expr != addr + && (TREE_CODE (expr) == NOP_EXPR + || TREE_CODE (expr) == CONVERT_EXPR + || TREE_CODE (expr) == NON_LVALUE_EXPR) + && TREE_CODE (expr) == TREE_CODE (addr) + && TYPE_MAIN_VARIANT (TREE_TYPE (expr)) + == TYPE_MAIN_VARIANT (TREE_TYPE (addr))) + { + expr = TREE_OPERAND (expr, 0); + addr = TREE_OPERAND (addr, 0); + } + return expr == addr; + } if (TREE_CODE (addr) == ADDR_EXPR && expr == TREE_OPERAND (addr, 0)) return true; return false; diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 3a7d2f5..08b417b 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,8 @@ +2007-11-10 Jakub Jelinek <jakub@redhat.com> + + PR fortran/34020 + * testsuite/libgomp.fortran/pr34020.f90: New test. + 2007-11-06 Jakub Jelinek <jakub@redhat.com> PR c++/33894 diff --git a/libgomp/testsuite/libgomp.fortran/pr34020.f90 b/libgomp/testsuite/libgomp.fortran/pr34020.f90 new file mode 100644 index 0000000..3bb14f5 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/pr34020.f90 @@ -0,0 +1,19 @@ +! PR fortran/34020 +! { dg-do run } + + subroutine atomic_add(lhs, rhs) + real lhs, rhs +!$omp atomic + lhs = rhs + lhs + end + + real lhs, rhs + integer i + lhs = 0 + rhs = 1 +!$omp parallel do num_threads(8) shared(lhs, rhs) + do i = 1, 300000 + call atomic_add(lhs, rhs) + enddo + if (lhs .ne. 300000) call abort + end |