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]

[patch, gomp] PR29949 - implement argument checking for user accessable runtime routines


:ADDPATCH libgomp:

If the argument passed to omp_set_num_threads is negative or zero, set the
number of threads to 1.

Tested on i686-pc-linux-gnu.


2006-11-23  Daniel Franke  <franke.daniel@gmail.com>

	PR libgomp/29949
	* env.c (omp_set_num_threads): Set illegal thread count to 1.


If this is ok for trunk/4.2, could someone be so kind to commit it? (*)

Regards
	Daniel


(*) I do not have write privileges to svn, but yes, the paperwork with FSF is
done.
Index: libgomp/env.c
===================================================================
--- libgomp/env.c	(revision 119061)
+++ 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]