diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-04 10:26:00 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-04 10:26:00 +0000 |
commit | 497f2858ac9b8d97b197b4657b4145ae0c7534a8 (patch) | |
tree | f94786a4fcf50b6049962a9a01cc79e07e724e65 /libgomp/loop.c | |
parent | 03ed154b4d8e57e186b37733cf5b095a5f506a2f (diff) | |
download | gcc-497f2858ac9b8d97b197b4657b4145ae0c7534a8.tar.gz |
PR libgomp/29947
* omp-low.c (expand_omp_for_static_nochunk,
expand_omp_for_static_chunk): Do all arithmetics in signed rather than
unsigned type.
* loop.c (gomp_loop_init): Make parameters signed. Set ws->end to
start if there shouldn't be any loop iterations.
(gomp_loop_ordered_static_start): Remove start == end test.
* testsuite/libgomp.c/pr29947-1.c: New test.
* testsuite/libgomp.c/pr29947-2.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@119485 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp/loop.c')
-rw-r--r-- | libgomp/loop.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/libgomp/loop.c b/libgomp/loop.c index 3d1b1efaf31..58fd9a8af28 100644 --- a/libgomp/loop.c +++ b/libgomp/loop.c @@ -34,13 +34,14 @@ /* Initialize the given work share construct from the given arguments. */ static inline void -gomp_loop_init (struct gomp_work_share *ws, unsigned long start, - unsigned long end, unsigned long incr, - enum gomp_schedule_type sched, unsigned long chunk_size) +gomp_loop_init (struct gomp_work_share *ws, long start, long end, long incr, + enum gomp_schedule_type sched, long chunk_size) { ws->sched = sched; ws->chunk_size = chunk_size; - ws->end = end; + /* Canonicalize loops that have zero iterations to ->next == ->end. */ + ws->end = ((incr > 0 && start > end) || (incr < 0 && start < end)) + ? start : end; ws->incr = incr; ws->next = start; } @@ -148,9 +149,6 @@ gomp_loop_ordered_static_start (long start, long end, long incr, { struct gomp_thread *thr = gomp_thread (); - if (start == end) - return false; - if (gomp_work_share_start (true)) { gomp_loop_init (thr->ts.work_share, start, end, incr, |