From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 389DA38582BF for ; Fri, 9 Sep 2022 10:08:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 389DA38582BF Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.93,302,1654588800"; d="scan'208";a="82597818" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 09 Sep 2022 02:08:43 -0800 IronPort-SDR: R+VVhWU5vBEbawDvPcp5sD3xfqIEhf4FzTw6HC7lnq3Nnr/VWeKQH+WagoCzh8Dahv8PUHSNDW lcjK2uji+N5zmNQGPLYZiaE8j8PYPtmiGsffSkQ2t/QSmoPToEtgKeVem5fnaBU4NwDstjuYdi SeyE7RALv+0+izybJd/rdpTyyJfDAPmPcfwll8s5zlZDmJvEVEMHZSRSkmE58oZ3smA/M4xLKt IChlSNzgC9CTrjXxQKjddgCjBxCHxhz5yCrHixqzh6rKlQuy2e2eBnWyZC65pyYXludhsFlHDF 4ss= Message-ID: <264c5146-7f8c-56f3-9e24-736855be365c@codesourcery.com> Date: Fri, 9 Sep 2022 18:08:30 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: [PING x2] Re: [PATCH, libgomp] Fix chunk_size<1 for dynamic schedule From: Chung-Lin Tang To: "Koning, Paul" , Jakub Jelinek CC: Tobias Burnus , GCC Patches References: <13568991-7359-9149-04fa-cde2245f108c@codesourcery.com> <3C4616A6-7AB6-428E-B20F-FEC2AA55A98D@dell.com> <15b51f2d-80da-aca4-4bb2-ad6e03010b62@codesourcery.com> Content-Language: en-US In-Reply-To: <15b51f2d-80da-aca4-4bb2-ad6e03010b62@codesourcery.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: svr-orw-mbx-13.mgc.mentorg.com (147.34.90.213) To svr-orw-mbx-10.mgc.mentorg.com (147.34.90.210) X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2022/8/26 4:15 PM, Chung-Lin Tang wrote: > On 2022/8/4 9:31 PM, Koning, Paul wrote: >> >> >>> On Aug 4, 2022, at 9:17 AM, Chung-Lin Tang 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 > > Ping? Ping x2.