This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[libgomp, patch, committed] PR29949 - Set illegal thread count to 1


On Thursday 30 November 2006 22:10, Diego Novillo wrote:

> Daniel Franke wrote on 11/23/06 15:25:
> > 	PR libgomp/29949
> > 	* env.c (omp_set_num_threads): Set illegal thread count to 1.
>
> Can't officially approve it, but this looks obvious.

Thus, committed under the obvious rule for trunk.
Tested on i686-pc-linux-gnu.

Since it is better to be save than sorry: the ChangeLog indicates a similar 
fix that was not yet ported to 4.2. Should both changes, Uros and mine, be 
applied to 4.2 as well?

2006-11-09  Uros Bizjak  <ubizjak@gmail.com>

        * env.c (parse_schedule): Reject out of range values.
        (parse_unsigned_long): Reject out of range, negative or zero values.

Regards
	Daniel
Index: libgomp/env.c
===================================================================
--- libgomp/env.c	(revision 119509)
+++ libgomp/env.c	(working copy)
@@ -225,7 +225,7 @@
 void
 omp_set_num_threads (int n)
 {
-  gomp_nthreads_var = n;
+  gomp_nthreads_var = (n > 0 ? n : 1);
 }
 
 void

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]