public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/100494] New: Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)
@ 2021-05-09 19:56 john at thesnappy dot net
  2021-05-09 20:18 ` [Bug tree-optimization/100494] " john at thesnappy dot net
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: john at thesnappy dot net @ 2021-05-09 19:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100494
           Summary: Unterminated recursion in gimple-range.cc
                    (x86_64-w64-mingw32)
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: john at thesnappy dot net
  Target Milestone: ---

While using GCC-11.1.0 on x86_64-w64-mingw32 native to build libiberty sha1.c,
gimple-range.cc enters what looks like unending recursion: the stack gets over
600 frames deep.

Steps to reproduce:
1. Build GCC-11.1.0 for x86_64-w64-mingw32 with default -O2.
2. Attempt to compile binutils-2.36.1/libiberty/sha1.c with -O2 or higher (-O1
does not trigger the issue)

gdb.exe --args
c:/crossdev/gccmaster/host-toolchain-cross4/bin/../libexec/gcc/x86_64-w64-mingw32/11.1.0/cc1.exe
-quiet -v -I . -I C:/crossdev/src/binutils-git-2_36_1/libiberty/../include
-iprefix
c:\crossdev\gccmaster\host-toolchain-cross4\bin\../lib/gcc/x86_64-w64-mingw32/11.1.0/
-D_REENTRANT -D HAVE_CONFIG_H -D __USE_MINGW_ACCESS -D _GNU_SOURCE
C:/crossdev/src/binutils-git-2_36_1/libiberty/sha1.c -quiet -dumpbase sha1.c
-dumpbase-ext .c -mtune=generic -march=x86-64 -g -O2 -Wextra -Wall
-Wwrite-strings -Wc++-compat -Wstrict-prototypes -Wshadow=local -Wpedantic
-version -o C:\msys64\tmp\cc3zpuNw.s
GNU gdb (GDB) 10.1
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-w64-mingw32".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from
c:/crossdev/gccmaster/host-toolchain-cross4/bin/../libexec/gcc/x86_64-w64-mingw32/11.1.0/cc1.exe...
(gdb) b value-range.cc:1683
Breakpoint 1 at 0x1407b4b70: file
../../../../src/gcc-git-11.1.0/gcc/value-range.cc, line 1683.
(gdb) r
Starting program:
c:\crossdev\gccmaster\host-toolchain-cross4\libexec\gcc\x86_64-w64-mingw32\11.1.0\cc1.exe
-quiet -v -I . -I C:/crossdev/src/binutils-git-2_36_1/libiberty/../include
-iprefix
c:\crossdev\gccmaster\host-toolchain-cross4\bin\../lib/gcc/x86_64-w64-mingw32/11.1.0/
-D_REENTRANT -D HAVE_CONFIG_H -D __USE_MINGW_ACCESS -D _GNU_SOURCE
C:/crossdev/src/binutils-git-2_36_1/libiberty/sha1.c -quiet -dumpbase sha1.c
-dumpbase-ext .c "-mtune=generic" "-march=x86-64" -g -O2 -Wextra -Wall
-Wwrite-strings -Wc++-compat -Wstrict-prototypes "-Wshadow=local" -Wpedantic
-version -o C:\msys64\tmp\cc3zpuNw.s
[New Thread 15968.0x5594]
[New Thread 15968.0x34f8]
[New Thread 15968.0x4304]
GNU C17 (GCC) version 11.1.0 (x86_64-w64-mingw32)
        compiled by GNU C version 10.3.0, GMP version 6.2.1, MPFR version
4.1.0, MPC version 1.2.1, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"C:/crossdev/prefix-cross2-x86_64-w64-mingw32/lib/gcc/x86_64-w64-mingw32/11.1.0/include"
ignoring nonexistent directory
"C:/crossdev/prefix-cross2-x86_64-w64-mingw32/include"
ignoring nonexistent directory
"/crossdev/prefix-cross2-x86_64-w64-mingw32/include"
ignoring nonexistent directory
"C:/crossdev/prefix-cross2-x86_64-w64-mingw32/lib/gcc/x86_64-w64-mingw32/11.1.0/include-fixed"
ignoring nonexistent directory
"C:/crossdev/prefix-cross2-x86_64-w64-mingw32/x86_64-w64-mingw32/include"
#include "..." search starts here:
#include <...> search starts here:
 .
 C:/crossdev/src/binutils-git-2_36_1/libiberty/../include

c:\crossdev\gccmaster\host-toolchain-cross4\bin\../lib/gcc/x86_64-w64-mingw32/11.1.0/include

c:\crossdev\gccmaster\host-toolchain-cross4\bin\../lib/gcc/x86_64-w64-mingw32/11.1.0/../../../../include

c:\crossdev\gccmaster\host-toolchain-cross4\bin\../lib/gcc/x86_64-w64-mingw32/11.1.0/include-fixed

c:\crossdev\gccmaster\host-toolchain-cross4\bin\../lib/gcc/x86_64-w64-mingw32/11.1.0/../../../../x86_64-w64-mingw32/include
 /mingw/include
End of search list.
GNU C17 (GCC) version 11.1.0 (x86_64-w64-mingw32)
        compiled by GNU C version 10.3.0, GMP version 6.2.1, MPFR version
4.1.0, MPC version 1.2.1, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: aa2c29976909033911bae4d4392787e2

Thread 1 hit Breakpoint 1, irange::irange_intersect (this=0x5fe500, r=...)
    at ../../../../src/gcc-git-11.1.0/gcc/value-range.cc:1683
1683    {
(gdb) c 179
Will ignore next 178 crossings of breakpoint 1.  Continuing.

Thread 1 hit Breakpoint 1, irange::irange_intersect (this=0x418360, r=...)
    at ../../../../src/gcc-git-11.1.0/gcc/value-range.cc:1683
1683    {
(gdb) bt

#0  ___chkstk_ms () at
../../../../../src/gcc-git-10.3.0/libgcc/config/i386/cygwin.S:117
#1  0x00000001407b4b86 in irange::irange_intersect (this=0x40ea30, r=...)
    at ../../../../src/gcc-git-11.1.0/gcc/value-range.cc:1683
#2  0x0000000140de72d2 in irange::intersect (r=..., this=0x40ea30)
    at ../../../../src/gcc-git-11.1.0/gcc/value-range.h:546
#3  gimple_ranger::range_of_stmt (this=0x29769a0, r=..., s=<optimized out>,
name=0x2ac1b88)
    at ../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:1073
#4  0x0000000140de30a9 in gimple_ranger::range_of_expr (this=0x29769a0, r=...,
expr=0x2ac1b88, stmt=<optimized out>)
    at ../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:960
#5  0x0000000140de4681 in gimple_ranger::range_of_range_op
(this=this@entry=0x29769a0, r=..., s=s@entry=0x2ac4000)
    at ../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:438
#6  0x0000000140de6c77 in gimple_ranger::calc_stmt (this=this@entry=0x29769a0,
r=..., s=s@entry=0x2ac4000,
    name=name@entry=0x2ac1c60) at
../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:374
#7  0x0000000140de72b5 in gimple_ranger::range_of_stmt (this=0x29769a0, r=...,
s=0x2ac4000, name=0x2ac1c60)
    at ../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:1068
#8  0x0000000140de30a9 in gimple_ranger::range_of_expr (this=0x29769a0, r=...,
expr=0x2ac1c60, stmt=<optimized out>)
    at ../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:960
#9  0x0000000140de4681 in gimple_ranger::range_of_range_op
(this=this@entry=0x29769a0, r=..., s=s@entry=0x2ac40b0)
    at ../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:438
#10 0x0000000140de6c77 in gimple_ranger::calc_stmt (this=this@entry=0x29769a0,
r=..., s=s@entry=0x2ac40b0,
    name=name@entry=0x2ac1d38) at
../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:374
#11 0x0000000140de72b5 in gimple_ranger::range_of_stmt (this=0x29769a0, r=...,
s=0x2ac40b0, name=0x2ac1d38)
    at ../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:1068
#12 0x0000000140de30a9 in gimple_ranger::range_of_expr (this=0x29769a0, r=...,
expr=0x2ac1d38, stmt=<optimized out>)
    at ../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:960
#13 0x0000000140de4681 in gimple_ranger::range_of_range_op
(this=this@entry=0x29769a0, r=..., s=s@entry=0x2ac4108)
    at ../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:438
#14 0x0000000140de6c77 in gimple_ranger::calc_stmt (this=this@entry=0x29769a0,
r=..., s=s@entry=0x2ac4108,
    name=name@entry=0x2b29678) at
../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:374
--Type <RET> for more, q to quit, c to continue without paging--
#15 0x0000000140de72b5 in gimple_ranger::range_of_stmt (this=0x29769a0, r=...,
s=0x2ac4108, name=0x2b29678)
    at ../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:1068
#16 0x0000000140de30a9 in gimple_ranger::range_of_expr (this=0x29769a0, r=...,
expr=0x2b29678, stmt=<optimized out>)
    at ../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:960
#17 0x0000000140de46a9 in gimple_ranger::range_of_range_op
(this=this@entry=0x29769a0, r=..., s=s@entry=0x2ac4160)
    at ../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:443
#18 0x0000000140de6c77 in gimple_ranger::calc_stmt (this=this@entry=0x29769a0,
r=..., s=s@entry=0x2ac4160,
    name=name@entry=0x2b296c0) at
../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:374
#19 0x0000000140de72b5 in gimple_ranger::range_of_stmt (this=0x29769a0, r=...,
s=0x2ac4160, name=0x2b296c0)
    at ../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:1068
#20 0x0000000140de30a9 in gimple_ranger::range_of_expr (this=0x29769a0, r=...,
expr=0x2b296c0, stmt=<optimized out>)

...

#599 0x0000000140de30a9 in gimple_ranger::range_of_expr (this=0x29c1a70, r=...,
expr=0x2a53288, stmt=<optimized out>) at
../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:960
#600 0x0000000140de4681 in gimple_ranger::range_of_range_op
(this=this@entry=0x29c1a70, r=..., s=s@entry=0x2a50f78) at
../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:438
#601 0x0000000140de6c77 in gimple_ranger::calc_stmt (this=this@entry=0x29c1a70,
r=..., s=s@entry=0x2a50f78, name=name@entry=0x2a8edc8) at
../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:374
#602 0x0000000140de72b5 in gimple_ranger::range_of_stmt (this=0x29c1a70, r=...,
s=0x2a50f78, name=0x2a8edc8) at
../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:1068
#603 0x0000000140de30a9 in gimple_ranger::range_of_expr (this=0x29c1a70, r=...,
expr=0x2a8edc8, stmt=<optimized out>) at
../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:960
#604 0x0000000140de46a9 in gimple_ranger::range_of_range_op
(this=this@entry=0x29c1a70, r=..., s=s@entry=0x2a54000) at
../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:443
#605 0x0000000140de6c77 in gimple_ranger::calc_stmt (this=this@entry=0x29c1a70,
r=..., s=s@entry=0x2a54000, name=name@entry=0x2a8ee10) at
../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:374
#606 0x0000000140de72b5 in gimple_ranger::range_of_stmt (this=0x29c1a70, r=...,
s=0x2a54000, name=0x2a8ee10) at
../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:1068
#607 0x0000000140de30a9 in gimple_ranger::range_of_expr (this=0x29c1a70, r=...,
expr=0x2a8ee10, stmt=<optimized out>) at
../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:960
#608 0x0000000140de46a9 in gimple_ranger::range_of_range_op
(this=this@entry=0x29c1a70, r=..., s=s@entry=0x2a540b0) at
../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:443
#609 0x0000000140de6c77 in gimple_ranger::calc_stmt (this=this@entry=0x29c1a70,
r=..., s=s@entry=0x2a540b0, name=name@entry=0x2a53318) at
../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:374
#610 0x0000000140de72b5 in gimple_ranger::range_of_stmt (this=0x29c1a70, r=...,
s=0x2a540b0, name=0x2a53318) at
../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:1068
#611 0x0000000140de30a9 in gimple_ranger::range_of_expr (this=0x29c1a70, r=...,
expr=0x2a53318, stmt=<optimized out>) at
../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:960
#612 0x0000000140de21ea in gimple_ranger::range_on_edge (this=0x29c1a70, r=...,
e=0x2a56120, name=0x2a53318) at
../../../../src/gcc-git-11.1.0/gcc/gimple-range.cc:1030
#613 0x00000001407ad28f in range_query::value_on_edge (this=0x29c1a70,
e=<optimized out>, name=0x2a53318) at
../../../../src/gcc-git-11.1.0/gcc/value-query.cc:106
#614 0x0000000140df0cca in hybrid_folder::value_on_edge (this=0x5ff800,
e=0x2a56120, op=0x2a53318) at
../../../../src/gcc-git-11.1.0/gcc/gimple-ssa-evrp.c:245
#615 0x000000014068c39b in substitute_and_fold_engine::replace_phi_args_in
(this=0x5ff800, phi=phi@entry=0x295be00) at
../../../../src/gcc-git-11.1.0/gcc/tree-ssa-propagate.c:913
#616 0x000000014068c64d in substitute_and_fold_dom_walker::before_dom_children
(this=0x5ff750, bb=0x2a089a0) at
../../../../src/gcc-git-11.1.0/gcc/tree-ssa-propagate.c:1087
#617 0x0000000140dbe846 in dom_walker::walk (this=0x5ff750, bb=0x2a089a0) at
../../../../src/gcc-git-11.1.0/gcc/domwalk.c:309
#618 0x000000014068bd58 in substitute_and_fold_engine::substitute_and_fold
(this=<optimized out>, block=block@entry=0x0) at
../../../../src/gcc-git-11.1.0/gcc/tree-ssa-propagate.c:1283
#619 0x0000000140df090d in execute_early_vrp () at
../../../../src/gcc-git-11.1.0/gcc/gimple-ssa-evrp.c:349
#620 0x00000001404705e5 in execute_one_pass (pass=pass@entry=0x2500630) at
../../../../src/gcc-git-11.1.0/gcc/passes.c:2567
#621 0x0000000140470f78 in execute_pass_list_1 (pass=0x2500630) at
../../../../src/gcc-git-11.1.0/gcc/passes.c:2656
#622 0x0000000140470f8a in execute_pass_list_1 (pass=0x2500120) at
../../../../src/gcc-git-11.1.0/gcc/passes.c:2657
#623 0x0000000140470fc1 in execute_pass_list (fn=0x28ba0c0, pass=<optimized
out>) at ../../../../src/gcc-git-11.1.0/gcc/passes.c:2667
#624 0x000000014046dca3 in do_per_function_toporder
(callback=callback@entry=0x140470fa0 <execute_pass_list(function*, opt_pass*)>,
data=0x24ffee0) at ../../../../src/gcc-git-11.1.0/gcc/passes.c:1773
#625 0x0000000140471540 in do_per_function_toporder (data=<optimized out>,
callback=0x140470fa0 <execute_pass_list(function*, opt_pass*)>) at
../../../../src/gcc-git-11.1.0/gcc/passes.c:1741
#626 execute_ipa_pass_list (pass=0x24ffe50) at
../../../../src/gcc-git-11.1.0/gcc/passes.c:3001
#627 0x00000001401771b0 in ipa_passes () at
../../../../src/gcc-git-11.1.0/gcc/cgraphunit.c:2156
#628 symbol_table::compile (this=this@entry=0x24db000) at
../../../../src/gcc-git-11.1.0/gcc/cgraphunit.c:2291
#629 0x0000000140179834 in symbol_table::compile (this=0x24db000) at
../../../../src/gcc-git-11.1.0/gcc/cgraphunit.c:2271
#630 symbol_table::finalize_compilation_unit (this=0x24db000) at
../../../../src/gcc-git-11.1.0/gcc/cgraphunit.c:2539
#631 0x000000014053336c in compile_file () at
../../../../src/gcc-git-11.1.0/gcc/toplev.c:482
#632 0x00000001411192f3 in do_compile () at
../../../../src/gcc-git-11.1.0/gcc/toplev.c:2201
#633 toplev::main (this=this@entry=0x5ffe0e, argc=<optimized out>,
argc@entry=36, argv=<optimized out>, argv@entry=0x161910) at
../../../../src/gcc-git-11.1.0/gcc/toplev.c:2340
#634 0x0000000141144677 in main (argc=36, argv=0x161910) at
../../../../src/gcc-git-11.1.0/gcc/main.c:39

Eventually __chkstk_ms encounters a segfault.

Thread 1 received signal SIGSEGV, Segmentation fault.
___chkstk_ms () at
../../../../../src/gcc-git-10.3.0/libgcc/config/i386/cygwin.S:126
126     ../../../../../src/gcc-git-10.3.0/libgcc/config/i386/cygwin.S: No such
file or directory.
(gdb) bt
#0  ___chkstk_ms () at
../../../../../src/gcc-git-10.3.0/libgcc/config/i386/cygwin.S:126
#1  0x0000000000001040 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

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

* [Bug tree-optimization/100494] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)
  2021-05-09 19:56 [Bug tree-optimization/100494] New: Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32) john at thesnappy dot net
@ 2021-05-09 20:18 ` john at thesnappy dot net
  2021-05-10  8:15 ` [Bug tree-optimization/100494] [11/12 Regression] " rguenth at gcc dot gnu.org
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: john at thesnappy dot net @ 2021-05-09 20:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from J.M. Eubank <john at thesnappy dot net> ---
Created attachment 50781
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50781&action=edit
sha1-O2-save-temps

joeub@DESKTOP-1LUONFR MINGW64
/crossdev/gccmaster/build-cross4/binutils/libiberty
$ ls sha1-O2-save-temps/
sha1.i  sha1.o  sha1.s

joeub@DESKTOP-1LUONFR MINGW64
/crossdev/gccmaster/build-cross4/binutils/libiberty
$ tar -ahcf sha1-O2-save-temps.tar.gz sha1-O2-save-temps

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

* [Bug tree-optimization/100494] [11/12 Regression] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)
  2021-05-09 19:56 [Bug tree-optimization/100494] New: Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32) john at thesnappy dot net
  2021-05-09 20:18 ` [Bug tree-optimization/100494] " john at thesnappy dot net
@ 2021-05-10  8:15 ` rguenth at gcc dot gnu.org
  2021-05-14 20:51 ` aldyh at gcc dot gnu.org
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-10  8:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Unterminated recursion in   |[11/12 Regression]
                   |gimple-range.cc             |Unterminated recursion in
                   |(x86_64-w64-mingw32)        |gimple-range.cc
                   |                            |(x86_64-w64-mingw32)
           Priority|P3                          |P2
   Target Milestone|---                         |11.2

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

* [Bug tree-optimization/100494] [11/12 Regression] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)
  2021-05-09 19:56 [Bug tree-optimization/100494] New: Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32) john at thesnappy dot net
  2021-05-09 20:18 ` [Bug tree-optimization/100494] " john at thesnappy dot net
  2021-05-10  8:15 ` [Bug tree-optimization/100494] [11/12 Regression] " rguenth at gcc dot gnu.org
@ 2021-05-14 20:51 ` aldyh at gcc dot gnu.org
  2021-06-13 14:54 ` john at thesnappy dot net
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: aldyh at gcc dot gnu.org @ 2021-05-14 20:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
I cannot reproduce on a cross configured with:

~/src/gcc/configure --target=x86_64-w64-mingw32 --enable-languages=c
--disable-bootstrap

I tried:

./cc1 sha1.i -quiet -mtune=generic -march=x86-64 -g -O2 -Wextra -Wall
-Wwrite-strings -Wc++-compat -Wstrict-prototypes -Wshadow=local -Wpedantic -w

It works in both the GCC 11 branch and trunk.

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

* [Bug tree-optimization/100494] [11/12 Regression] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)
  2021-05-09 19:56 [Bug tree-optimization/100494] New: Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32) john at thesnappy dot net
                   ` (2 preceding siblings ...)
  2021-05-14 20:51 ` aldyh at gcc dot gnu.org
@ 2021-06-13 14:54 ` john at thesnappy dot net
  2021-06-14 21:07 ` amacleod at redhat dot com
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: john at thesnappy dot net @ 2021-06-13 14:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from J.M. Eubank <john at thesnappy dot net> ---
Yes, this definitely seems specific to the native x86_64-w64-mingw32 build.

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

* [Bug tree-optimization/100494] [11/12 Regression] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)
  2021-05-09 19:56 [Bug tree-optimization/100494] New: Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32) john at thesnappy dot net
                   ` (3 preceding siblings ...)
  2021-06-13 14:54 ` john at thesnappy dot net
@ 2021-06-14 21:07 ` amacleod at redhat dot com
  2021-06-15 13:35 ` john at thesnappy dot net
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: amacleod at redhat dot com @ 2021-06-14 21:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Macleod <amacleod at redhat dot com> ---
I just checked a patch in for PR 101014 which I suspect will fix this as well..
want to give it a try off trunk?   I plan to port it to gcc 11 as well

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

* [Bug tree-optimization/100494] [11/12 Regression] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)
  2021-05-09 19:56 [Bug tree-optimization/100494] New: Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32) john at thesnappy dot net
                   ` (4 preceding siblings ...)
  2021-06-14 21:07 ` amacleod at redhat dot com
@ 2021-06-15 13:35 ` john at thesnappy dot net
  2021-06-15 13:36 ` amacleod at redhat dot com
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: john at thesnappy dot net @ 2021-06-15 13:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from J.M. Eubank <john at thesnappy dot net> ---
Unfortunately it doesn't seem to have made a difference in this case.

x86_64-w64-mingw32-gcc -c -DHAVE_CONFIG_H -O2 -g  -D__USE_MINGW_ACCESS  -I.
-I/crossdev/src/binutils-git-2_36_1/libiberty/../include  -W -Wall
-Wwrite-strings -Wc++-compat -Wstrict-prototypes -Wshadow=local -ped
make[3]: *** [Makefile:1260: sha1.o] Error 1

$ /c/crossdev/gccmaster/host-toolchain-cross4/bin/x86_64-w64-mingw32-gcc -v
Using built-in specs.
COLLECT_GCC=C:\crossdev\gccmaster\host-toolchain-cross4\bin\x86_64-w64-mingw32-gcc.exe
COLLECT_LTO_WRAPPER=c:/crossdev/gccmaster/host-toolchain-cross4/bin/../libexec/gcc/x86_64-w64-mingw32/12.0.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with:
../../../src/gcc-git-ecc5644fa3bc7f37eada2a3e9c627cd1918922e0/configure
--build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --enable-targets=all
--target=x86_64-w64-mingw32 --prefix=/crossdev/prefix-cross2-x86_64-w64-mingw32
--enable-static --disable-shared --enable-languages=ada,c,c++ --disable-werror
--with-gnu-ld --disable-nls --disable-win32-registry --disable-bootstrap
--enable-sjlj-exceptions --enable-threads=posix
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210614 (experimental) (GCC)

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

* [Bug tree-optimization/100494] [11/12 Regression] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)
  2021-05-09 19:56 [Bug tree-optimization/100494] New: Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32) john at thesnappy dot net
                   ` (5 preceding siblings ...)
  2021-06-15 13:35 ` john at thesnappy dot net
@ 2021-06-15 13:36 ` amacleod at redhat dot com
  2021-06-15 14:02 ` john at thesnappy dot net
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: amacleod at redhat dot com @ 2021-06-15 13:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrew Macleod <amacleod at redhat dot com> ---
WE collided making comments :-)   
--- or maybe not.. that traceback doesn't look like it would be affected :-(.

The traceback also doesn't look like its in an infinite loop?.. there can be
long chains of calls to resolve things on back edges. Looking at the listing
for that file, I see at its maximal depth, the call chain is 492 "traceable"
statements deep. This does not include range_of_range_op or calc_stmt method
calls, so Id expect the peak call depth to be about 30-40% higher than that, so
somewhere in the 640-690 deep range from the first hybrid_folder::value_on_edge
call.  Your call chain is at 619, so that is not completely unexpected. 

Does the compilation not finish? or just take ma very long time?   On the other
targets it finishes very quickly, spending very little time in EVRP.  Its
unclear to me why this target would be so different, unless a deep call stack
is a problem. 

Does the issue go away with --param=evrp-mode=legacy   ?

If it does seem to go into an infinite loop, can you try it with
   -fdump-tree-evrp-details --param=evrp-mode=trace

That will generate a sha1*.evrp file, and if you are truly in an infinite loop
it will become quite long.  On x86-64 mine is 48940 lines long when it
finishes.  If you have to stop it, and its growing excessively, I shouldn't
need more than the first 50,000 lines to see what going on.

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

* [Bug tree-optimization/100494] [11/12 Regression] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)
  2021-05-09 19:56 [Bug tree-optimization/100494] New: Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32) john at thesnappy dot net
                   ` (6 preceding siblings ...)
  2021-06-15 13:36 ` amacleod at redhat dot com
@ 2021-06-15 14:02 ` john at thesnappy dot net
  2021-06-15 14:15 ` amacleod at redhat dot com
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: john at thesnappy dot net @ 2021-06-15 14:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from J.M. Eubank <john at thesnappy dot net> ---
Created attachment 51024
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51024&action=edit
sha1.c.038t.evrp.gz

> Does the compilation not finish? or just take ma very long time?   On the other targets it finishes very quickly, spending very little time in EVRP.  Its unclear to me why this target would be so different, unless a deep call stack is a problem.

The default stack limit is 1 MiB, so a bit of quick math from the above
addresses I posted puts us at 1.2 MiB - this definitely is in line with chkstk
failing as we go out of bounds, I think.

> Does the issue go away with --param=evrp-mode=legacy   ?

Yes, it does!

> If it does seem to go into an infinite loop, can you try it with
>    -fdump-tree-evrp-details --param=evrp-mode=trace

Attached.

joeub@DESKTOP-1LUONFR MINGW64
/crossdev/gccmaster/build-cross4/binutils/libiberty
$ /crossdev/gccmaster/host-toolchain-cross4/bin/x86_64-w64-mingw32-gcc -I . -I
C:/crossdev/src/binutils-git-2_36_1/libiberty/../include -iprefix
c:\crossdev\gccmaster\host-toolchain-cross4\bin\../lib/gcc/x86_64-w64-mingw32/11.1.0/
-D_REENTRANT -D HAVE_CONFIG_H -D __USE_MINGW_ACCESS -D _GNU_SOURCE
C:/crossdev/src/binutils-git-2_36_1/libiberty/sha1.c -g -O2 -c
-fdump-tree-evrp-details --param=evrp-mode=trace

joeub@DESKTOP-1LUONFR MINGW64
/crossdev/gccmaster/build-cross4/binutils/libiberty
$ echo $?
1 <-- indicator for chkstk failure in cc1

joeub@DESKTOP-1LUONFR MINGW64
/crossdev/gccmaster/build-cross4/binutils/libiberty
$ gzip sha1.c.038t.evrp

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

* [Bug tree-optimization/100494] [11/12 Regression] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)
  2021-05-09 19:56 [Bug tree-optimization/100494] New: Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32) john at thesnappy dot net
                   ` (7 preceding siblings ...)
  2021-06-15 14:02 ` john at thesnappy dot net
@ 2021-06-15 14:15 ` amacleod at redhat dot com
  2021-06-15 14:23 ` john at thesnappy dot net
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: amacleod at redhat dot com @ 2021-06-15 14:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Andrew Macleod <amacleod at redhat dot com> ---
ah. So this is an issue with excessive stack consumption. yeah, we don't really
try to reign that in, so certain patterns can get quite deep.

I am unfamiliar with what mitigations/flags the compiler has for trying to
control this.  It would certainly be possible to monitor the call depth and
cease at a certain point, but Im not sure what needs to be queried.   Is this
information communicated by a target in some way? and checked against some
criteria for passes which may need to limit their consumption?

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

* [Bug tree-optimization/100494] [11/12 Regression] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)
  2021-05-09 19:56 [Bug tree-optimization/100494] New: Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32) john at thesnappy dot net
                   ` (8 preceding siblings ...)
  2021-06-15 14:15 ` amacleod at redhat dot com
@ 2021-06-15 14:23 ` john at thesnappy dot net
  2021-06-15 14:34 ` amacleod at redhat dot com
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: john at thesnappy dot net @ 2021-06-15 14:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from J.M. Eubank <john at thesnappy dot net> ---
> I am unfamiliar with what mitigations/flags the compiler has for trying to control this.  It would certainly be possible to monitor the call depth and cease at a certain point, but Im not sure what needs to be queried.   Is this information communicated by a target in some way? and checked against some criteria for passes which may need to limit their consumption?

+1, this would be nice?

I'm running a build with -Wl,--stack=10485760 (10 MiB) to see if this
alleviates the problem. However, I'm definitely curious to see how this might
be handled for other actually constrained targets where that's not an option -
do they simply recommend not to use -O2?

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

* [Bug tree-optimization/100494] [11/12 Regression] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)
  2021-05-09 19:56 [Bug tree-optimization/100494] New: Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32) john at thesnappy dot net
                   ` (9 preceding siblings ...)
  2021-06-15 14:23 ` john at thesnappy dot net
@ 2021-06-15 14:34 ` amacleod at redhat dot com
  2021-06-16 13:13 ` john at thesnappy dot net
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: amacleod at redhat dot com @ 2021-06-15 14:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Andrew Macleod <amacleod at redhat dot com> ---
I would imagine there is some check I should be making that i was unaware of..
but since I'm unaware of it, I don't know what it is :-)

This wouldn't be a "dont use -O2" issue, this would be an "Andrew, check the
darn limits before going hogwild on call depth" issue

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

* [Bug tree-optimization/100494] [11/12 Regression] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)
  2021-05-09 19:56 [Bug tree-optimization/100494] New: Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32) john at thesnappy dot net
                   ` (10 preceding siblings ...)
  2021-06-15 14:34 ` amacleod at redhat dot com
@ 2021-06-16 13:13 ` john at thesnappy dot net
  2021-06-16 13:50 ` amacleod at redhat dot com
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: john at thesnappy dot net @ 2021-06-16 13:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from J.M. Eubank <john at thesnappy dot net> ---
Confirmed that building with a larger default stack size on Windows works to
bootstrap GCC and binutils and dependencies - I chose -Wl,--stack=10485760 (10
MiB) but probably 2-4 MiB would be sufficient.

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

* [Bug tree-optimization/100494] [11/12 Regression] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)
  2021-05-09 19:56 [Bug tree-optimization/100494] New: Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32) john at thesnappy dot net
                   ` (11 preceding siblings ...)
  2021-06-16 13:13 ` john at thesnappy dot net
@ 2021-06-16 13:50 ` amacleod at redhat dot com
  2021-07-28  7:06 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 17+ messages in thread
From: amacleod at redhat dot com @ 2021-06-16 13:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Andrew Macleod <amacleod at redhat dot com> ---
My understanding from a quick check around is we usually expect 8-10 MB of
stack space.  I have an idea how to flatten the call stack a bit, so leave this
open for that purpose if nothing else.

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

* [Bug tree-optimization/100494] [11/12 Regression] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)
  2021-05-09 19:56 [Bug tree-optimization/100494] New: Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32) john at thesnappy dot net
                   ` (12 preceding siblings ...)
  2021-06-16 13:50 ` amacleod at redhat dot com
@ 2021-07-28  7:06 ` rguenth at gcc dot gnu.org
  2021-07-30 14:39 ` amacleod at redhat dot com
  2021-12-01 14:28 ` amacleod at redhat dot com
  15 siblings, 0 replies; 17+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-28  7:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.2                        |11.3

--- Comment #13 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.2 is being released, retargeting bugs to GCC 11.3

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

* [Bug tree-optimization/100494] [11/12 Regression] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)
  2021-05-09 19:56 [Bug tree-optimization/100494] New: Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32) john at thesnappy dot net
                   ` (13 preceding siblings ...)
  2021-07-28  7:06 ` rguenth at gcc dot gnu.org
@ 2021-07-30 14:39 ` amacleod at redhat dot com
  2021-12-01 14:28 ` amacleod at redhat dot com
  15 siblings, 0 replies; 17+ messages in thread
From: amacleod at redhat dot com @ 2021-07-30 14:39 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Macleod <amacleod at redhat dot com> changed:

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

--- Comment #14 from Andrew Macleod <amacleod at redhat dot com> ---
The call chain is a bit less deep in GCC 12 now, but I doubt it can still
operate with a stack as small as the original.
As there is no un-terminated recursion, I will now close this as I don't plan
any additional reductions in the call chain beyond what has been done.  Future
enhancements may improve it further however.

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

* [Bug tree-optimization/100494] [11/12 Regression] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)
  2021-05-09 19:56 [Bug tree-optimization/100494] New: Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32) john at thesnappy dot net
                   ` (14 preceding siblings ...)
  2021-07-30 14:39 ` amacleod at redhat dot com
@ 2021-12-01 14:28 ` amacleod at redhat dot com
  15 siblings, 0 replies; 17+ messages in thread
From: amacleod at redhat dot com @ 2021-12-01 14:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Andrew Macleod <amacleod at redhat dot com> ---
Stack frame depth issued should be completely resolved in GCC12 now by patches
for PR 103231 and a follow up for PR 103464.

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

end of thread, other threads:[~2021-12-01 14:28 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-09 19:56 [Bug tree-optimization/100494] New: Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32) john at thesnappy dot net
2021-05-09 20:18 ` [Bug tree-optimization/100494] " john at thesnappy dot net
2021-05-10  8:15 ` [Bug tree-optimization/100494] [11/12 Regression] " rguenth at gcc dot gnu.org
2021-05-14 20:51 ` aldyh at gcc dot gnu.org
2021-06-13 14:54 ` john at thesnappy dot net
2021-06-14 21:07 ` amacleod at redhat dot com
2021-06-15 13:35 ` john at thesnappy dot net
2021-06-15 13:36 ` amacleod at redhat dot com
2021-06-15 14:02 ` john at thesnappy dot net
2021-06-15 14:15 ` amacleod at redhat dot com
2021-06-15 14:23 ` john at thesnappy dot net
2021-06-15 14:34 ` amacleod at redhat dot com
2021-06-16 13:13 ` john at thesnappy dot net
2021-06-16 13:50 ` amacleod at redhat dot com
2021-07-28  7:06 ` rguenth at gcc dot gnu.org
2021-07-30 14:39 ` amacleod at redhat dot com
2021-12-01 14:28 ` amacleod at redhat dot com

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