From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 82AF23858004 for ; Fri, 26 Aug 2022 08:15:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 82AF23858004 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,264,1654588800"; d="scan'208";a="84734011" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 26 Aug 2022 00:15:35 -0800 IronPort-SDR: qpGFoSoc/4qOFtanXQPFJj+M1FtzEnIrZhOHiepJS00nSN6+xg0FruF5foylB8TiaSoPa81hC0 +QAEK+hu3BxYS3Fp6+azSz8PEci2LsrjOhRnJDmHJfhZQkuz5FctHhz6SoTFqNPt4YwSIKwe6E /zmANsRkN7elr7DsQ81EZfrHQRRsJHYSy3JfE9HyY6Wt2pBzcFxSlk1g9hH1LofxDP9Vf/HUyb aig1PGKS8g/lVW8YHjUSQW9pZRE3YDwmf1fNySXI9ZGp0IiW1ctTHCFZpYOp2bdUjoVPBZEffg NTA= Message-ID: <15b51f2d-80da-aca4-4bb2-ad6e03010b62@codesourcery.com> Date: Fri, 26 Aug 2022 16:15:30 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: [PING] Re: [PATCH, libgomp] Fix chunk_size<1 for dynamic schedule Content-Language: en-US To: "Koning, Paul" CC: Jakub Jelinek , Tobias Burnus , GCC Patches References: <13568991-7359-9149-04fa-cde2245f108c@codesourcery.com> <3C4616A6-7AB6-428E-B20F-FEC2AA55A98D@dell.com> From: Chung-Lin Tang In-Reply-To: <3C4616A6-7AB6-428E-B20F-FEC2AA55A98D@dell.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: svr-orw-mbx-11.mgc.mentorg.com (147.34.90.211) 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/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?