[Bug tree-optimization/100494] [11/12 Regression] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)

2021-06-16 Thread john at thesnappy dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100494

--- Comment #11 from J.M. Eubank  ---
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.

[Bug tree-optimization/100494] [11/12 Regression] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)

2021-06-15 Thread john at thesnappy dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100494

--- Comment #9 from J.M. Eubank  ---
> 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?

[Bug tree-optimization/100494] [11/12 Regression] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)

2021-06-15 Thread john at thesnappy dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100494

--- Comment #7 from J.M. Eubank  ---
Created attachment 51024
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51024=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

[Bug tree-optimization/100494] [11/12 Regression] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)

2021-06-15 Thread john at thesnappy dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100494

--- Comment #5 from J.M. Eubank  ---
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)

[Bug tree-optimization/100494] [11/12 Regression] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)

2021-06-13 Thread john at thesnappy dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100494

--- Comment #3 from J.M. Eubank  ---
Yes, this definitely seems specific to the native x86_64-w64-mingw32 build.

[Bug tree-optimization/100494] Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)

2021-05-09 Thread john at thesnappy dot net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100494

--- Comment #1 from J.M. Eubank  ---
Created attachment 50781
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50781=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

[Bug tree-optimization/100494] New: Unterminated recursion in gimple-range.cc (x86_64-w64-mingw32)

2021-05-09 Thread john at thesnappy dot net via 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 
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:
.
Find the GDB manual and other documentation resources online at:
.

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