Hi!

According to a clarification on OpenMP forums, if(0) which creates
an undeferred task doesn't mean if the implementation chooses to schedule
it right away that it is included task.  Included tasks are thus only
the children tasks of some final task.

Fixed thusly:

2011-05-05  Jakub Jelinek  <ja...@redhat.com>

        * task.c (omp_in_final): Don't return true if not final_task.

        * testsuite/libgomp.c/task-5.c: Adjust.
        * testsuite/libgomp.c++/task-8.C: Likewise.
        * testsuite/libgomp/fortran/task3.f90: Likewise.

--- libgomp/task.c.jj   2011-04-28 14:44:18.000000000 +0200
+++ libgomp/task.c      2011-05-05 16:02:05.000000000 +0200
@@ -378,8 +378,7 @@ int
 omp_in_final (void)
 {
   struct gomp_thread *thr = gomp_thread ();
-  return thr->task && (thr->task->kind == GOMP_TASK_IFFALSE
-                      || thr->task->final_task);
+  return thr->task && thr->task->final_task;
 }
 
 ialias (omp_in_final)
--- libgomp/testsuite/libgomp.c/task-5.c.jj     2011-04-28 17:04:24.000000000 
+0200
+++ libgomp/testsuite/libgomp.c/task-5.c        2011-05-05 16:03:44.000000000 
+0200
@@ -16,11 +16,11 @@ main ()
        err = 1;
     #pragma omp task if (0) shared(err)
       {
-       if (!omp_in_final ())
+       if (omp_in_final ())
          #pragma omp atomic write
            err = 1;
        #pragma omp task if (0) shared(err)
-         if (!omp_in_final ())
+         if (omp_in_final ())
            #pragma omp atomic write
              err = 1;
       }
--- libgomp/testsuite/libgomp.c++/task-8.C.jj   2011-04-28 17:04:37.000000000 
+0200
+++ libgomp/testsuite/libgomp.c++/task-8.C      2011-05-05 16:04:08.000000000 
+0200
@@ -16,11 +16,11 @@ main ()
        err = 1;
     #pragma omp task if (0) shared(err)
       {
-       if (!omp_in_final ())
+       if (omp_in_final ())
          #pragma omp atomic write
            err = 1;
        #pragma omp task if (0) shared(err)
-         if (!omp_in_final ())
+         if (omp_in_final ())
            #pragma omp atomic write
              err = 1;
       }
--- libgomp/testsuite/libgomp.fortran/task3.f90.jj      2011-04-28 
14:55:50.000000000 +0200
+++ libgomp/testsuite/libgomp.fortran/task3.f90 2011-05-05 16:04:29.000000000 
+0200
@@ -9,12 +9,12 @@
     err = 1
   endif
 !$omp task if (.false.) shared(err)
-  if (.not.omp_in_final ()) then
+  if (omp_in_final ()) then
 !$omp atomic write
     err = 1
   endif
 !$omp task if (.false.) shared(err)
-  if (.not.omp_in_final ()) then
+  if (omp_in_final ()) then
 !$omp atomic write
     err = 1
   endif

        Jakub

Reply via email to