]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/62131 (OpenMP: Subobject of an allocatable array not allowed in OMP...
authorJakub Jelinek <jakub@redhat.com>
Fri, 15 Aug 2014 10:23:13 +0000 (12:23 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 15 Aug 2014 10:23:13 +0000 (12:23 +0200)
PR fortran/62131
* openmp.c (resolve_omp_atomic): Only complain if code->expr1's attr
is allocatable, rather than whenever var->attr.allocatable.

* gfortran.dg/gomp/pr62131.f90: New test.

Co-Authored-By: Tobias Burnus <burnus@net-b.de>
From-SVN: r214010

gcc/fortran/ChangeLog
gcc/fortran/openmp.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/gomp/pr62131.f90 [new file with mode: 0644]

index f6e3082d1c649d58e5479dc19ec471821e92a648..411fe4c8f5063c8ffeb511c02d33b157390058ab 100644 (file)
@@ -1,3 +1,10 @@
+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
index 49c3b9e86c1acb326658968392572ae083fbcd12..217fce73828dde56a56304a7910555aa49c0841c 100644 (file)
@@ -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);
index ab8e0544302e258919073e37041d83403d8e6e99..505df55667cac1419ef4312ee212f61d6f2cd83a 100644 (file)
@@ -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 (file)
index 0000000..8e88cd7
--- /dev/null
@@ -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