From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by sourceware.org (Postfix) with ESMTPS id 3CCE1385841D; Fri, 10 Mar 2023 18:01:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3CCE1385841D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x52d.google.com with SMTP id ay14so23753934edb.11; Fri, 10 Mar 2023 10:01:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1678471301; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=GbADrlo81TzAgCDhIIzR+o2heObrqRKhUUzz50Sit/Y=; b=K16N5QF4kRL2EGXsS8dKP1UNFZhKr7OLvWIzJ5KmfEgxv+WBQ8mgebYnjww1I7IR0J qcDqx5v1MXdTyLvRPROK4gHSYQP1MJYBrqrXTX8ONyKefuJA+uloxsx2OfN7VrfRbk3z kBZx/xFVCJEZrUS5z/Lli8GigELjqjPAO+58EfQPVJcnU2zTTLIAwA/sT2JRiGk2xPVb mQL6Ss9KwAzV6wYcHbHG/ovYg1HTVoVvkmiwn+Q1d5TkBS5FXYdJcOiMSojE33myP5U0 u/9eAyNgsmblWVa7c14NgvaeYe/wcgelAmxZBXiimV3x4q5Wy0SPsAu79LAPGBn/jKA2 mgPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678471301; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GbADrlo81TzAgCDhIIzR+o2heObrqRKhUUzz50Sit/Y=; b=QT7Bmdut3FA7PMvD4/BAHm1dYmdg04imtIvZIzQbaHtWIE6LN0icpnFON+xlN9fPUp YXyxbbmBssugdm4wJQoVH/eRi2m6Mgx3IwCuAgbvvLkGfb/pCPKViEaA7IfXJhw26zTf IZrugpZ7goO0ByE8Ban97t7Hbby/9FZ7TmBGhw3CdhXGM/U1GJvgGrz4uBFOKOy+zdoY lsUTIMcHShSsfJ69Fz9ehKR6JYE1LBUB6hj7iLi2sAMapCO5wpa6ksvzyNcO1nhs6dgo Up3tPI+GGm+6AfSGhGjtwQz+0ZoXPe4I1SwvUMcuKSmCEzj6DjQGvrewZkgDJUssV8Bh PpIA== X-Gm-Message-State: AO0yUKWbnj36TMDC+fu3CnPwPUmLDX3EiEQ/3rkDTBUfE9RzHNcN7Qkn pvf5Aak4+toqo83u1niniEf8FhBsAhY= X-Google-Smtp-Source: AK7set/x6i6QX2Zrv6OyT+ZbFqJFZfG7zR9/TJm0WoamFPvxcXpMgKx2b2pBWlULaky35U2WV5Uz9Q== X-Received: by 2002:aa7:d29a:0:b0:4af:69b8:52ba with SMTP id w26-20020aa7d29a000000b004af69b852bamr24111054edq.25.1678471301021; Fri, 10 Mar 2023 10:01:41 -0800 (PST) Received: from smtpclient.apple (dynamic-095-117-118-049.95.117.pool.telefonica.de. [95.117.118.49]) by smtp.gmail.com with ESMTPSA id kw23-20020a170907771700b008d8f1b238fdsm137844ejc.149.2023.03.10.10.01.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 10 Mar 2023 10:01:40 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Richard Biener Mime-Version: 1.0 (1.0) Subject: Re: [patch, Fortran] Enable -fwrapv for -std=legacy Date: Fri, 10 Mar 2023 19:01:29 +0100 Message-Id: <5C328B17-0588-45F4-8A39-F468F7E9F326@gmail.com> References: Cc: fortran@gcc.gnu.org, gcc-patches In-Reply-To: To: Thomas Koenig X-Mailer: iPhone Mail (20D67) X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,MIME_QP_LONG_LINE,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP 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: > Am 10.03.2023 um 18:54 schrieb Thomas Koenig via Fortran : >=20 > =EF=BB=BFHello world, here's the patch that was discussed. >=20 > Regression-tested. OK for trunk? >=20 > Since this appeared only in gcc13, I see no need for a backport. > I will also document this in the changes file. The =E2=80=9Eproblem=E2=80=9C is latent forever, I=E2=80=99m not sure it=E2=80= =99s good to amend the kitchen-sink std=3Dlegacy option with -fwrapv since t= hat has quite some negative effects on optimization. Richard=20 > Best regards >=20 > Thomas >=20 > Set -frapv if -std=3Dlegacy is set. >=20 > Fortran legacy codes sometimes contain linear congruential > seudorandom number generators. These generators implicitly depend > on wrapping behavior on integer overflow, which is illegal Fortran, > but the best they could to at the time. >=20 > A gcc13 change exposed this in rnflow, part of the Polyhedron > benchmark, with -O3. Rather than "regress" on such code, this patch > enables -fwrapv if -std=3Dlegacy is enabled. This allows the benchmark > to run successfully, and presumably lots of other code as well. >=20 > gcc/fortran/ChangeLog: >=20 > PR fortran/109075 > * options.cc (gfc_handle_option): If -std=3Dlegacy is set, > also set -frwapv. > * invoke.texi: Document the change. >