From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E58CB3858D33; Thu, 9 Mar 2023 09:08:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E58CB3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678352935; bh=p0Llpac5yyUXy928QbfRyilVU3R4sGAbkmQG+gb8Lfw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PBPbwV1D4Mpo2aLEtJ94kzEuUlwGkkLYIIPZ2u3U1rOcT5qFaqjn8Y+rYaeDP7gdE uMUMOkK7LtGFNv6wI8SzfVzDFpvzLRb5QIq8KSRoIcPr6IvasljRkk3GqixFoWdBdh nboZ51Q9V4hXaSvb42ajiKyH6N/kVsPfsQkTjEGI= From: "tkoenig at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: unknown X-Bugzilla-Keywords: needs-bisection X-Bugzilla-Severity: normal X-Bugzilla-Who: tkoenig at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109075 --- Comment #5 from Thomas Koenig --- 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=3Dall 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=3Dlegacy (and also mention this in the relase notes).=