https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82788
Bug ID: 82788
Summary: wrong code with -fstack-clash-protection
--param=stack-clash-protection-probe-interval=10 on
simple code
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: zsojka at seznam dot cz
Target Milestone: ---
Created attachment 42507
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42507&action=edit
reduced testcase
$ cat testcase.c
int main() { int a[1442]; }
$ x86_64-pc-linux-gnu-gcc -fstack-clash-protection
--param=stack-clash-protection-probe-interval=10 testcase.c
$ ./a.out
Segmentation fault
In the assembly, there is a loop that never finishes (until it segfaults):
...
lea r11, [rsp-5120]
.LPSRL0:
sub rsp, 4096
or DWORD PTR [rsp], 0
cmp rsp, r11
jne .LPSRL0
...
$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-254242-checking-yes-rtl-df-extra-nographite-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--without-cloog --without-ppl --without-isl --build=x86_64-pc-linux-gnu
--host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu
--with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-254242-checking-yes-rtl-df-extra-nographite-amd64
Thread model: posix
gcc version 8.0.0 20171030 (experimental) (GCC)