public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/109075] [13 Regression] rnflow hangs at -O3
Date: Thu, 09 Mar 2023 09:08:54 +0000	[thread overview]
Message-ID: <bug-109075-4-6LqRYJ2icQ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109075-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109075

--- Comment #5 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Might be invalid code, see

https://gcc.gnu.org/pipermail/fortran/2023-March/059062.html

That appears to be a problem with widely used old-style linear congruential
random number generators, which expect overflow to just silently
truncate.

Looking at the test case with nagfor -C=all shows the problem:

  0: 0: 0.000 -> Read sequence
  0: 0: 0.150 -> extract extrema
  0: 0: 0.159 -> Generate raw transitions counts
  0: 0: 0.183 -> Compute Markov matrix
  0: 0: 0.184 -> Calculate theoretical rainflow
  0: 0:43.286 -> Simulate random markov sequences
Runtime Error: rnflow.f90, line 902: INTEGER(int32) overflow for 843314861 *
1993

The issue with the patch is that it is also illegal Fortran, because the
assignment outside the value range of a default integer is also illegal.
Again, nagfor catches this:

  0: 0: 0.000 -> Read sequence
  0: 0: 0.140 -> extract extrema
  0: 0: 0.150 -> Generate raw transitions counts
  0: 0: 0.175 -> Compute Markov matrix
  0: 0: 0.175 -> Calculate theoretical rainflow
  0: 0:44.032 -> Simulate random markov sequences
Runtime Error: rnflow.f90, line 905: Overflow converting 1681180334666 to
INTEGER(int32)

So, what to do?  I think we need to mention this in the release notes,
and also a workaround which gives the same result.

If there is a flag which suppresses whatever this does, we could also
set this with -std=legacy (and also mention this in the relase notes).

  parent reply	other threads:[~2023-03-09  9:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09  7:05 [Bug tree-optimization/109075] New: " tkoenig at gcc dot gnu.org
2023-03-09  7:05 ` [Bug tree-optimization/109075] " tkoenig at gcc dot gnu.org
2023-03-09  7:06 ` tkoenig at gcc dot gnu.org
2023-03-09  7:07 ` tkoenig at gcc dot gnu.org
2023-03-09  7:08 ` tkoenig at gcc dot gnu.org
2023-03-09  9:08 ` tkoenig at gcc dot gnu.org [this message]
2023-03-09  9:26 ` jakub at gcc dot gnu.org
2023-03-09  9:36 ` tkoenig at gcc dot gnu.org
2023-03-09 10:13 ` jakub at gcc dot gnu.org
2023-03-09 10:22 ` rguenth at gcc dot gnu.org
2023-03-09 13:23 ` pault at gcc dot gnu.org
2023-03-09 13:29 ` pault at gcc dot gnu.org

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=bug-109075-4-6LqRYJ2icQ@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).