re PR fortran/47886 (ICE: OpenMP !$omp task if(omp_get_num_threads() > 0))
authorTobias Burnus <burnus@net-b.de>
Sat, 26 Feb 2011 19:36:41 +0000 (20:36 +0100)
committerTobias Burnus <burnus@gcc.gnu.org>
Sat, 26 Feb 2011 19:36:41 +0000 (20:36 +0100)
2011-02-26  Tobias Burnus  <burnus@net-b.de>

        PR fortran/47886
        * openmp.c (gfc_resolve_omp_directive): Resolve if()
        condition of OpenMP's task.

2011-02-26  Tobias Burnus  <burnus@net-b.de>

        PR fortran/47886
        * gfortran.dg/gomp/task-1.f90: New.

From-SVN: r170521

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

index 85cf01f73c7acc2993068c0dd25d3266879fa626..c6836f7e67450402498c7f3c65aee1ee80fe4ce3 100644 (file)
@@ -1,3 +1,9 @@
+2011-02-26  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/47886
+       * openmp.c (gfc_resolve_omp_directive): Resolve if()
+       condition of OpenMP's task.
+
 2011-02-26  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        PR fortran/47894
index 24e32eb5d044879046f31131d35b0cf3bf55e377..2b70c69a9845299b1119bb9d18cc02fe1207fab3 100644 (file)
@@ -1573,6 +1573,7 @@ gfc_resolve_omp_directive (gfc_code *code, gfc_namespace *ns ATTRIBUTE_UNUSED)
     case EXEC_OMP_PARALLEL_SECTIONS:
     case EXEC_OMP_SECTIONS:
     case EXEC_OMP_SINGLE:
+    case EXEC_OMP_TASK:
       if (code->ext.omp_clauses)
        resolve_omp_clauses (code);
       break;
index 5bdfd04544a30b0f728fa45858e804712dd78b4e..3cb2809056b13631ece174cfba809700020e7a07 100644 (file)
@@ -1,3 +1,8 @@
+2011-02-26  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/47886
+       * gfortran.dg/gomp/task-1.f90: New.
+
 2011-02-25  Jie Zhang  <jie@codesourcery.com>
 
        * gcc.target/arm/neon-thumb2-move.c: Add
diff --git a/gcc/testsuite/gfortran.dg/gomp/task-1.f90 b/gcc/testsuite/gfortran.dg/gomp/task-1.f90
new file mode 100644 (file)
index 0000000..227902c
--- /dev/null
@@ -0,0 +1,27 @@
+! { dg-do compile }
+! { dg-options "-fopenmp" }
+!
+! PR fortran/47886
+!
+! Test case contributed by Bill Long
+
+!  derived from OpenMP test OMP3f/F03_2_7_1d.F90
+program F03_2_7_1d
+   use omp_lib
+   implicit none
+   integer, parameter :: NT = 4
+   integer :: sum = 0
+
+   call omp_set_num_threads(NT); 
+
+   !$omp parallel
+   !$omp task if(omp_get_num_threads() > 0)
+   !$omp atomic
+      sum = sum + 1
+   !$omp end task
+   !$omp end parallel
+   if (sum /= NT) then
+      print *, "FAIL - sum == ", sum, " (expected ", NT, ")"
+      stop 1;
+   end if
+end program F03_2_7_1d