public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/109075] New: [13 Regression] rnflow hangs at -O3
@ 2023-03-09  7:05 tkoenig at gcc dot gnu.org
  2023-03-09  7:05 ` [Bug tree-optimization/109075] " tkoenig at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2023-03-09  7:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109075
           Summary: [13 Regression] rnflow hangs at -O3
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tkoenig at gcc dot gnu.org
  Target Milestone: ---

rnflow from the pb11 Polyhedron benchmark hangs at -O3 with recent trunk,

gcc-Version 13.0.1 20230308 (experimental) [master revision
e87559d202d:f4e6da6e8ac:36ec54aac7da134441c83248e14825381b8d6f17] (GCC)

Compiling with -O3 -g, running under gdb and interrupting the program 
sometime after

(gdb) r rnflow.in 
Starting program: /tmp/a.out rnflow.in
  0: 0: 0.000 -> Read sequence
  0: 0: 0.213 -> extract extrema
  0: 0: 0.215 -> Generate raw transitions counts
  0: 0: 0.221 -> Compute Markov matrix
  0: 0: 0.221 -> Calculate theoretical rainflow
  0: 0: 7.487 -> Simulate random markov sequences
^C
Program received signal SIGINT, Interrupt.
0x0000000000402149 in minlst (ipos2=<optimized out>, ipos1=<optimized out>) at
rnflow.f90:3698
3698             if (xxtrt (ipos) < xxtrt (minlst)) then
(gdb) l
3693    !
3694    ! .. dernier minimum de xxtrt entre ipos1 et ipos2
3695    !
3696          minlst = ipos2
3697          do ipos = ipos2 - 1, ipos1, -1
3698             if (xxtrt (ipos) < xxtrt (minlst)) then
3699                minlst = ipos
3700             endif
3701          enddo
3702          end function minlst

where it goes into an endless loop.  This happens both on x86_64 and
on POWER.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug tree-optimization/109075] [13 Regression] rnflow hangs at -O3
  2023-03-09  7:05 [Bug tree-optimization/109075] New: [13 Regression] rnflow hangs at -O3 tkoenig at gcc dot gnu.org
@ 2023-03-09  7:05 ` tkoenig at gcc dot gnu.org
  2023-03-09  7:06 ` tkoenig at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2023-03-09  7:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Created attachment 54617
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54617&action=edit
rnflow.f90

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug tree-optimization/109075] [13 Regression] rnflow hangs at -O3
  2023-03-09  7:05 [Bug tree-optimization/109075] New: [13 Regression] rnflow hangs at -O3 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
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2023-03-09  7:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Created attachment 54618
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54618&action=edit
Header file needed for compilation

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug tree-optimization/109075] [13 Regression] rnflow hangs at -O3
  2023-03-09  7:05 [Bug tree-optimization/109075] New: [13 Regression] rnflow hangs at -O3 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
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2023-03-09  7:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Created attachment 54619
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54619&action=edit
Compressed input file

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug tree-optimization/109075] [13 Regression] rnflow hangs at -O3
  2023-03-09  7:05 [Bug tree-optimization/109075] New: [13 Regression] rnflow hangs at -O3 tkoenig at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  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
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2023-03-09  7:08 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |needs-bisection
   Target Milestone|---                         |13.0

--- Comment #4 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
As also confirmed by Paul Thomas, the program works fine at -O2.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug tree-optimization/109075] [13 Regression] rnflow hangs at -O3
  2023-03-09  7:05 [Bug tree-optimization/109075] New: [13 Regression] rnflow hangs at -O3 tkoenig at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-03-09  7:08 ` tkoenig at gcc dot gnu.org
@ 2023-03-09  9:08 ` tkoenig at gcc dot gnu.org
  2023-03-09  9:26 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2023-03-09  9:08 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug tree-optimization/109075] [13 Regression] rnflow hangs at -O3
  2023-03-09  7:05 [Bug tree-optimization/109075] New: [13 Regression] rnflow hangs at -O3 tkoenig at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-03-09  9:08 ` tkoenig at gcc dot gnu.org
@ 2023-03-09  9:26 ` jakub at gcc dot gnu.org
  2023-03-09  9:36 ` tkoenig at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-03-09  9:26 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
jmul is used just once, so I wonder if the easiest solution wouldn't be to make
jmul
PARAMETER kind=8.
Anyway, does -fwrapv work around it too?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug tree-optimization/109075] [13 Regression] rnflow hangs at -O3
  2023-03-09  7:05 [Bug tree-optimization/109075] New: [13 Regression] rnflow hangs at -O3 tkoenig at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2023-03-09  9:36 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |12.2.0

--- Comment #7 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
I've just checked 12.2.0, and the code does not hang there.

(In reply to Jakub Jelinek from comment #6)
> jmul is used just once, so I wonder if the easiest solution wouldn't be to
> make jmul
> PARAMETER kind=8.

We can change the benchmark source, but we cannot change the
existing code base using the same idiom out there :-|

> Anyway, does -fwrapv work around it too?

Yes, -frwapv works.

We could just include that in -std=legacy (it really is used for
legacy code) and mention it in the release notes, then.

How does that sound?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug tree-optimization/109075] [13 Regression] rnflow hangs at -O3
  2023-03-09  7:05 [Bug tree-optimization/109075] New: [13 Regression] rnflow hangs at -O3 tkoenig at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-03-09 10:13 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-bisection             |

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
BTW, rnflow without the tweaks started to hang with
r13-5103-g7c9f20fcfdc2d8453df8

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug tree-optimization/109075] [13 Regression] rnflow hangs at -O3
  2023-03-09  7:05 [Bug tree-optimization/109075] New: [13 Regression] rnflow hangs at -O3 tkoenig at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  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
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-03-09 10:22 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
duplicate

*** This bug has been marked as a duplicate of bug 71231 ***

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug tree-optimization/109075] [13 Regression] rnflow hangs at -O3
  2023-03-09  7:05 [Bug tree-optimization/109075] New: [13 Regression] rnflow hangs at -O3 tkoenig at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  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
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu.org @ 2023-03-09 13:23 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|DUPLICATE                   |INVALID
                 CC|                            |pault at gcc dot gnu.org
      Known to work|12.2.0                      |
           Keywords|                            |needs-bisection

--- Comment #10 from Paul Thomas <pault at gcc dot gnu.org> ---
See comment at rnflow.f90:899 - As Richard Biener suggested to the list
-fdefault-integer-8 fixes the problem but breaks tfft2 of the polyhedron suite.

Better is:
      integer(8), parameter   :: jmul =  843314861  ! multiplicateur
      integer(8), parameter   :: jadd =  453816693  ! constante additive

Cheers

Paul

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug tree-optimization/109075] [13 Regression] rnflow hangs at -O3
  2023-03-09  7:05 [Bug tree-optimization/109075] New: [13 Regression] rnflow hangs at -O3 tkoenig at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2023-03-09 13:23 ` pault at gcc dot gnu.org
@ 2023-03-09 13:29 ` pault at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: pault at gcc dot gnu.org @ 2023-03-09 13:29 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |needs-bisection

--- Comment #11 from Paul Thomas <pault at gcc dot gnu.org> ---
As a final remark from me, rnflow is not hanging but, rather, execution time
becomes quadratic in ndonm (in rnprfm.h) and is already tiresomely long at a
value of 400000, compared with the default 1000001.

Cheers

Paul

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-03-09 13:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-09  7:05 [Bug tree-optimization/109075] New: [13 Regression] rnflow hangs at -O3 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
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

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