diff options
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/openmp.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/gomp/pr62131.f90 | 19 |
4 files changed, 33 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index f6e3082..411fe4c 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,4 +1,11 @@ 2014-08-15 Jakub Jelinek <jakub@redhat.com> + Tobias Burnus <burnus@net-b.de> + + PR fortran/62131 + * openmp.c (resolve_omp_atomic): Only complain if code->expr1's attr + is allocatable, rather than whenever var->attr.allocatable. + +2014-08-15 Jakub Jelinek <jakub@redhat.com> PR fortran/62107 * trans-openmp.c (gfc_omp_finish_clause): Handle scalar pointer diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 49c3b9e..217fce7 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -2744,7 +2744,7 @@ resolve_omp_atomic (gfc_code *code) break; } - if (var->attr.allocatable) + if (gfc_expr_attr (code->expr1).allocatable) { gfc_error ("!$OMP ATOMIC with ALLOCATABLE variable at %L", &code->loc); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ab8e054..505df55 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2014-08-15 Jakub Jelinek <jakub@redhat.com> + Tobias Burnus <burnus@net-b.de> + + PR fortran/62131 + * gfortran.dg/gomp/pr62131.f90: New test. + 2014-08-15 Richard Biener <rguenther@suse.de> PR tree-optimization/62031 diff --git a/gcc/testsuite/gfortran.dg/gomp/pr62131.f90 b/gcc/testsuite/gfortran.dg/gomp/pr62131.f90 new file mode 100644 index 0000000..8e88cd7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/pr62131.f90 @@ -0,0 +1,19 @@ +! PR fortran/62131 +! { dg-do compile } +! { dg-options "-fopenmp" } + +program pr62131 + integer,allocatable :: nerrs(:,:) + allocate(nerrs(10,10)) + nerrs(:,:) = 0 +!$omp parallel do + do k=1,10 + call uperrs(k,1) + end do +contains + subroutine uperrs(i,io) + integer,intent(in) :: i,io +!$omp atomic + nerrs(i,io)=nerrs(i,io)+1 + end subroutine +end |