public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Koenig <tkoenig@netcologne.de>
To: Richard Biener <richard.guenther@gmail.com>
Cc: fortran@gcc.gnu.org, gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch, Fortran] Enable -fwrapv for -std=legacy
Date: Sat, 11 Mar 2023 10:06:39 +0100	[thread overview]
Message-ID: <2fb86fa3-0442-e81e-35fe-a66d6d425d11@netcologne.de> (raw)
In-Reply-To: <5C328B17-0588-45F4-8A39-F468F7E9F326@gmail.com>

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

  parent reply	other threads:[~2023-03-11  9:06 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
2023-03-10 19:47   ` Steve Kargl
2023-03-11  9:06   ` Thomas Koenig [this message]
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=2fb86fa3-0442-e81e-35fe-a66d6d425d11@netcologne.de \
    --to=tkoenig@netcologne.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /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).