public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Thomas Koenig <tkoenig@netcologne.de>
Cc: fortran@gcc.gnu.org, gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch, Fortran] Enable -fwrapv for -std=legacy
Date: Fri, 10 Mar 2023 19:01:29 +0100	[thread overview]
Message-ID: <5C328B17-0588-45F4-8A39-F468F7E9F326@gmail.com> (raw)
In-Reply-To: <eef3f64d-521e-e24d-80fb-24f18ee3e4e7@netcologne.de>



> Am 10.03.2023 um 18:54 schrieb Thomas Koenig via Fortran <fortran@gcc.gnu.org>:
> 
> Hello world, here's the patch that was discussed.
> 
> Regression-tested. OK for trunk?
> 
> Since this appeared only in gcc13, I see no need for a backport.
> I will also document this in the changes file.

The „problem“ 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.

Richard 

> Best regards
> 
>    Thomas
> 
> Set -frapv if -std=legacy is set.
> 
> 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.
> 
> 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=legacy is enabled.  This allows the benchmark
> to run successfully, and presumably lots of other code as well.
> 
> gcc/fortran/ChangeLog:
> 
>    PR fortran/109075
>    * options.cc (gfc_handle_option):  If -std=legacy is set,
>    also set -frwapv.
>    * invoke.texi: Document the change.
> <p1.diff>

  reply	other threads:[~2023-03-10 18:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-10 17:54 Thomas Koenig
2023-03-10 18:01 ` Richard Biener [this message]
2023-03-10 19:47   ` Steve Kargl
2023-03-11  9:06   ` Thomas Koenig
2023-03-10 18:01 ` Jakub Jelinek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5C328B17-0588-45F4-8A39-F468F7E9F326@gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=tkoenig@netcologne.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).