This is the mail archive of the
mailing list for the GCC project.
Re: [gomp] Fix degenerate omp for loops (PR libgomp/29949)
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- Cc: Jakub Jelinek <jakub at redhat dot com>, Richard Henderson <rth at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Sat, 02 Dec 2006 08:00:17 -0500
- Subject: Re: [gomp] Fix degenerate omp for loops (PR libgomp/29949)
- References: <45709D65.firstname.lastname@example.org> <20061201232306.GA13765@atrey.karlin.mff.cuni.cz>
Zdenek Dvorak wrote on 12/01/06 18:23:
Hello,But that should be fine. We are not required to handle cases where N2 -
N1 + INCR cannot be represented in the type of the loop variable.
Jakub Jelinek wrote on 12/01/06 11:32:
Lastly, the compiler expanded loops (static without chunk size, static with
chunk size) failed because the arithmetics to compute range given to the
current thread was mostly done in unsigned long and thus when N2 - N1
was negative (for positive STEP resp. positive for negative STEP), we ended
up with a huge range. I tried to figure out why this was cast to utype,
but haven't found why it has been written that way.
I think that not casting to unsigned type might give wrong results for
for (i = -many; i < many; i++)
ie. in cases the number of iterations does not fit in the signed type.
I would rather use signed integers to catch some of the easy cases,
though that could also be done by initially comparing the bounds.
Jakub, whatever method you find easiest to implement is fine.