]> oss.titaniummirror.com Git - msp430-gcc.git/blobdiff - libgomp/testsuite/libgomp.fortran/pr34020.f90
Imported gcc-4.4.3
[msp430-gcc.git] / libgomp / testsuite / libgomp.fortran / pr34020.f90
diff --git a/libgomp/testsuite/libgomp.fortran/pr34020.f90 b/libgomp/testsuite/libgomp.fortran/pr34020.f90
new file mode 100644 (file)
index 0000000..3bb14f5
--- /dev/null
@@ -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