> 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>