Patchwork [OpenMP] PR fortran/47886 fix ICE in OMP task's if() clause

login
register
mail settings
Submitter Tobias Burnus
Date Feb. 26, 2011, 7:38 p.m.
Message ID <4D69569B.2070204@net-b.de>
Download mbox | patch
Permalink /patch/84669/
State New
Headers show

Comments

Tobias Burnus - Feb. 26, 2011, 7:38 p.m.
Jakub Jelinek wrote:
>> Build and regtested on x86-64-linux.
>> OK for the trunk? What about GCC 4.4 and 4.5?
> Oh, forgot about that, can you please add a testcase for this?
> If you don't get to it, I'll do it on Monday.

Thanks for the reminder! I even regtested with a test case - but I 
forget to include it in the patch ...

Committed attached patch as Rev. 170521. I will backport after 
regtesting the branches.

Tobias

PS: Maybe I should again use "svn" where "svn add" simply works; in 
"git" one always starts staging files; one then needs to revert the 
staging, if one does not want to commit them ...
H.J. Lu - Feb. 26, 2011, 9:36 p.m.
On Sat, Feb 26, 2011 at 11:38 AM, Tobias Burnus <burnus@net-b.de> wrote:
> Jakub Jelinek wrote:
>>>
>>> Build and regtested on x86-64-linux.
>>> OK for the trunk? What about GCC 4.4 and 4.5?
>>
>> Oh, forgot about that, can you please add a testcase for this?
>> If you don't get to it, I'll do it on Monday.
>
> Thanks for the reminder! I even regtested with a test case - but I forget to
> include it in the patch ...
>
> Committed attached patch as Rev. 170521. I will backport after regtesting
> the branches.
>
>

The testcase has

use omp_lib

and failed:

/export/gnu/import/svn/gcc-test-ia32corei7/src-trunk/gcc/testsuite/gfortran.dg/gomp/task-1.f90:10.14:^M
^M
   use omp_lib^M
              1^M
Fatal Error: Can't open module file 'omp_lib.mod' for reading at (1): No such
file or directory^M
compiler exited with status 1

Shouldn't this testcase be in libgomp?

Patch

Index: gcc/testsuite/gfortran.dg/gomp/task-1.f90
===================================================================
--- gcc/testsuite/gfortran.dg/gomp/task-1.f90	(Revision 0)
+++ gcc/testsuite/gfortran.dg/gomp/task-1.f90	(Revision 0)
@@ -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
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(Revision 170520)
+++ gcc/testsuite/ChangeLog	(Arbeitskopie)
@@ -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
Index: gcc/fortran/openmp.c
===================================================================
--- gcc/fortran/openmp.c	(Revision 170520)
+++ gcc/fortran/openmp.c	(Arbeitskopie)
@@ -1573,6 +1573,7 @@ 
     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: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog	(Revision 170520)
+++ gcc/fortran/ChangeLog	(Arbeitskopie)
@@ -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