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

            Bug ID: 90496
           Summary: ICE in RTL pass pro_and_epilogue when all of `-flto
                    -fsanitize=address -fstack-usage` are used on trivial
                    source
           Product: gcc
           Version: 8.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gcc_bugs at codyps dot com
  Target Milestone: ---

Compiling `int main(void) { return 0; }` with _all_ of `-flto -fsantize=address
-fstack-usage` results in an ICE:

```
$ cat test1.c 
int main(void)
{
        return 0;
}
$ ./test
+ : gcc
+ gcc -v
Using built-in specs.
COLLECT_GCC=/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/8.3.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --enable-libmpx --with-system-zlib --with-isl
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu
--disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object
--enable-linker-build-id --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu
--enable-gnu-indirect-function --enable-multilib --disable-werror
--enable-checking=release --enable-default-pie --enable-default-ssp
--enable-cet=auto
Thread model: posix
gcc version 8.3.0 (GCC) 
+ gcc -o test1_a test1.c -flto -fsanitize=address
+ gcc -o test1_b test1.c -flto -fstack-usage
+ gcc -o test1_c test1.c -fsanitize=address -fstack-usage
+ gcc -o test1_d test1.c -flto -fsanitize=address -fstack-usage
during RTL pass: pro_and_epilogue
In function ‘_GLOBAL__sub_I_00099_0_cc3AMKZf.ltrans0.o’:
lto1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
lto-wrapper: fatal error: /bin/gcc returned 1 exit status
compilation terminated.
/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status

```

Script from above:
```
#! /bin/bash
set -xeuf -o pipefail
: ${CC:=gcc}
$CC -v
$CC -o test1_a test1.c -flto -fsanitize=address
$CC -o test1_b test1.c -flto -fstack-usage
$CC -o test1_c test1.c -fsanitize=address -fstack-usage
$CC -o test1_d test1.c -flto -fsanitize=address -fstack-usage
```

Reply via email to