summaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-02 19:19:28 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-02 19:19:28 +0000
commitc4fb4e80be86e6791ba25f38ef6f71a1bd30e2a5 (patch)
tree19dc9952a79a02112a3b9cffbad788ef06cca5ea /libgomp
parent885823085facb434df46acb75c0df87a883acc78 (diff)
downloadgcc-c4fb4e80be86e6791ba25f38ef6f71a1bd30e2a5.tar.gz
PR libgomp/32468
* sections.c (GOMP_parallel_sections_start): Only decrease number of threads to COUNT if dyn_var is true. * testsuite/libgomp.c/pr32468.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126224 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog7
-rw-r--r--libgomp/sections.c4
-rw-r--r--libgomp/testsuite/libgomp.c/pr32468.c26
3 files changed, 35 insertions, 2 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 6e5b09fb5a0..a9d1f5a40be 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,10 @@
+2007-07-02 Jakub Jelinek <jakub@redhat.com>
+
+ PR libgomp/32468
+ * sections.c (GOMP_parallel_sections_start): Only decrease
+ number of threads to COUNT if dyn_var is true.
+ * testsuite/libgomp.c/pr32468.c: New test.
+
2007-07-02 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
PR libgomp/26308
diff --git a/libgomp/sections.c b/libgomp/sections.c
index de0acd843ea..9ccc65e4b66 100644
--- a/libgomp/sections.c
+++ b/libgomp/sections.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2007 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU OpenMP Library (libgomp).
@@ -106,7 +106,7 @@ GOMP_parallel_sections_start (void (*fn) (void *), void *data,
struct gomp_work_share *ws;
num_threads = gomp_resolve_num_threads (num_threads);
- if (num_threads > count)
+ if (gomp_dyn_var && num_threads > count)
num_threads = count;
ws = gomp_new_work_share (false, num_threads);
diff --git a/libgomp/testsuite/libgomp.c/pr32468.c b/libgomp/testsuite/libgomp.c/pr32468.c
new file mode 100644
index 00000000000..f20f660bfcb
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c/pr32468.c
@@ -0,0 +1,26 @@
+/* PR libgomp/32468 */
+/* { dg-do run } */
+
+#include <omp.h>
+#include <stdlib.h>
+
+int
+main (void)
+{
+ int res[2] = { -1, -1 };
+ omp_set_dynamic (0);
+ omp_set_num_threads (4);
+#pragma omp parallel
+ {
+ #pragma omp sections
+ {
+ #pragma omp section
+ res[0] = omp_get_num_threads () != 4;
+ #pragma omp section
+ res[1] = omp_get_num_threads () != 4;
+ }
+ }
+ if (res[0] != 0 || res[1] != 0)
+ abort ();
+ return 0;
+}