From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cc-smtpout1.netcologne.de (cc-smtpout1.netcologne.de [89.1.8.211]) by sourceware.org (Postfix) with ESMTPS id 497DF3858D28; Sat, 11 Mar 2023 09:06:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 497DF3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=netcologne.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=netcologne.de Received: from cc-smtpin1.netcologne.de (cc-smtpin1.netcologne.de [89.1.8.201]) by cc-smtpout1.netcologne.de (Postfix) with ESMTP id 2946B124FC; Sat, 11 Mar 2023 10:06:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=netcologne.de; s=nc1116a; t=1678525602; bh=xhlYKT+4CqTvSSmlmZ6Od/FgsgBCoEVR77onH8R3tsQ=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To:From; b=K/Kln3spF8oO2SSMj5FcluIWBD7HKV9AGiv6/nc9DMNfjGYQUGViedqWdNvH44Y7t gQUt58iztjuI/qtf6apQzztFB7yJqrdeNiuJthmF8QJ/kogjADNF9g8w25JX1tWiT3 MnIwsTQbbcWVtPXwwpwWde9HmgM915ImcrRyUimLwEED5dj28NZ5XhgKT7psWw6+0a G9i25jiC2uxedQLKbCiZZqUHneH7An2aIOVCbmSJxz8he3+rW2qAfgnxpNb29z63Dt TM7v0n3UrphxyttCIhyXMZJO5PUXjX7rCUz4vXaCyCFak+1TlwCzSzoMJjNbp/oQ58 D0imSzyXCbVcw== Received: from [IPV6:2001:4dd7:c7b6:0:7285:c2ff:fe6c:992d] (2001-4dd7-c7b6-0-7285-c2ff-fe6c-992d.ipv6dyn.netcologne.de [IPv6:2001:4dd7:c7b6:0:7285:c2ff:fe6c:992d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by cc-smtpin1.netcologne.de (Postfix) with ESMTPSA id A8F4B11DFD; Sat, 11 Mar 2023 10:06:39 +0100 (CET) Message-ID: <2fb86fa3-0442-e81e-35fe-a66d6d425d11@netcologne.de> Date: Sat, 11 Mar 2023 10:06:39 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [patch, Fortran] Enable -fwrapv for -std=legacy To: Richard Biener Cc: fortran@gcc.gnu.org, gcc-patches References: <5C328B17-0588-45F4-8A39-F468F7E9F326@gmail.com> Content-Language: en-US From: Thomas Koenig In-Reply-To: <5C328B17-0588-45F4-8A39-F468F7E9F326@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-NetCologne-Spam: L X-Spamd-Bar: - X-Rspamd-Pre-Result: action=add header; module=force_actions; unknown reason X-Rspamd-Action: add header X-Rspamd-Queue-Id: A8F4B11DFD X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Richard, >> Since this appeared only in gcc13, I see no need for a backport. >> I will also document this in the changes file. > The „problem“ It's a real problem, I am afraid... >is latent forever, I’m not sure it’s good to amend the kitchen-sink >std=legacy option with -fwrapv since that has quite some negative > effects on optimization. So, what are the options? Do nothing, and get silent bad results. I do not think we can do this, there is too much code out there. Just look at Numerical Recipes, which has this kind of random number generator. Apply the patch (with spelling fixes). This has the drawback that you outlined, potential impact on optimization. Put a warning in the release notes. This will not help in general because 99.99% of users will not read it. Revert the patch exposing the problem. No. That would pessimize everything. Put the optimization behind a special flag. That also makes no sense, -fwrapv does the job. Would it be possible to add a warning? Anything of the sort a = b + c * a where b and c are larger than (in this case) 16 bits could be flagged. Other options? Best regards Thomas