> On Aug 4, 2022, at 9:17 AM, Chung-Lin Tang <clt...@codesourcery.com> wrote: > > On 2022/6/28 10:06 PM, Jakub Jelinek wrote: >> On Thu, Jun 23, 2022 at 11:47:59PM +0800, Chung-Lin Tang wrote: >>> with the way that chunk_size < 1 is handled for gomp_iter_dynamic_next: >>> >>> (1) chunk_size <= -1: wraps into large unsigned value, seems to work though. >>> (2) chunk_size == 0: infinite loop >>> >>> The (2) behavior is obviously not desired. This patch fixes this by changing >> Why? It is a user error, undefined behavior, we shouldn't slow down valid >> code for users who don't bother reading the standard. > > This is loop init code, not per-iteration. The overhead really isn't that > much. > > The question should be, if GCC having infinite loop behavior is reasonable, > even if it is undefined in the spec. I wouldn't think so. The way I see "undefined code" is that you can't complain about "wrong code" produced by the compiler. But for the compiler to malfunction on wrong input is an entirely differerent matter. For one thing, it's hard to fix your code if the compiler fails. How would you locate the offending source line? paul
Re: [PATCH, libgomp] Fix chunk_size<1 for dynamic schedule
Koning, Paul via Gcc-patches Thu, 04 Aug 2022 06:32:15 -0700
- Re: [PATCH, libgomp] Fix chunk_size<1 for... Chung-Lin Tang
- Re: [PATCH, libgomp] Fix chunk_size<... Koning, Paul via Gcc-patches
- [PING] Re: [PATCH, libgomp] Fix chu... Chung-Lin Tang
- [PING x2] Re: [PATCH, libgomp] ... Chung-Lin Tang
- Re: [PATCH, libgomp] Fix chunk_size<... Jakub Jelinek via Gcc-patches