From: Tobias Burnus Date: Sat, 26 Feb 2011 19:36:41 +0000 (+0100) Subject: re PR fortran/47886 (ICE: OpenMP !$omp task if(omp_get_num_threads() > 0)) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=adb3f0936d2f66b8c2aa96f671f5c112f274373f;p=gcc.git re PR fortran/47886 (ICE: OpenMP !$omp task if(omp_get_num_threads() > 0)) 2011-02-26 Tobias Burnus PR fortran/47886 * openmp.c (gfc_resolve_omp_directive): Resolve if() condition of OpenMP's task. 2011-02-26 Tobias Burnus PR fortran/47886 * gfortran.dg/gomp/task-1.f90: New. From-SVN: r170521 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 85cf01f73c7..c6836f7e674 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2011-02-26 Tobias Burnus + + PR fortran/47886 + * openmp.c (gfc_resolve_omp_directive): Resolve if() + condition of OpenMP's task. + 2011-02-26 Francois-Xavier Coudert PR fortran/47894 diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 24e32eb5d04..2b70c69a984 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5bdfd04544a..3cb2809056b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-02-26 Tobias Burnus + + PR fortran/47886 + * gfortran.dg/gomp/task-1.f90: New. + 2011-02-25 Jie Zhang * 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 index 00000000000..227902cbf5a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/task-1.f90 @@ -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