omp-low.c (expand_omp_sections): Always pass len - 1 to GOMP_sections_start, even...
authorJakub Jelinek <jakub@redhat.com>
Thu, 19 Sep 2013 11:52:52 +0000 (13:52 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 19 Sep 2013 11:52:52 +0000 (13:52 +0200)
* omp-low.c (expand_omp_sections): Always pass len - 1 to
GOMP_sections_start, even if !exit_reachable.
libgomp/
* testsuite/libgomp.c/sections-2.c: New test.

From-SVN: r202738

gcc/ChangeLog
gcc/omp-low.c
libgomp/ChangeLog
libgomp/testsuite/libgomp.c/sections-2.c [new file with mode: 0644]

index ad70c24516e8e42b1246ddd302861826e8193c62..99218e29f3ffb7b5eb62dd7335e1b5772131acab 100644 (file)
@@ -1,3 +1,8 @@
+2013-09-19  Jakub Jelinek  <jakub@redhat.com>
+
+       * omp-low.c (expand_omp_sections): Always pass len - 1 to
+       GOMP_sections_start, even if !exit_reachable.
+
 2013-09-18  Vladimir Makarov  <vmakarov@redhat.com>
 
        * lra-constraints.c (need_for_all_save_p): Use macro
index 221ae71a1c302b02ab966076293ae4a63ec21107..304ea363600af1b2fb994bd2c85b54f1b2d9f795 100644 (file)
@@ -5869,8 +5869,7 @@ expand_omp_sections (struct omp_region *region)
     {
       /* If we are not inside a combined parallel+sections region,
         call GOMP_sections_start.  */
-      t = build_int_cst (unsigned_type_node,
-                        exit_reachable ? len - 1 : len);
+      t = build_int_cst (unsigned_type_node, len - 1);
       u = builtin_decl_explicit (BUILT_IN_GOMP_SECTIONS_START);
       stmt = gimple_build_call (u, 1, t);
     }
index 6687169f1cefc7cbc694e7347e7f57a824f3dafc..67ce62795b056459a02db935132e615005d4fcbb 100644 (file)
@@ -1,3 +1,7 @@
+2013-09-19  Jakub Jelinek  <jakub@redhat.com>
+
+       * testsuite/libgomp.c/sections-2.c: New test.
+
 2013-06-28  Marcus Shawcroft  <marcus.shawcroft@arm.com>
 
        * testsuite/libgomp.fortran/strassen.f90:
diff --git a/libgomp/testsuite/libgomp.c/sections-2.c b/libgomp/testsuite/libgomp.c/sections-2.c
new file mode 100644 (file)
index 0000000..38216be
--- /dev/null
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+
+#include <stdlib.h>
+#include <unistd.h>
+
+__attribute__((noinline, noclone, noreturn))
+void
+foo ()
+{
+  sleep (4);
+  exit (0);
+}
+
+int
+main ()
+{
+  #pragma omp parallel
+  {
+    #pragma omp sections
+      {
+        foo ();
+      #pragma omp section
+        foo ();
+      #pragma omp section
+        foo ();
+      }
+  }
+  return 0;
+}