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

            Bug ID: 101218
           Summary: ICE on valid code with -O3 only: Segmentation fault,
                    vect_optimize_slp(vec_info*)
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.buHCZx7AOn-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210625 (experimental) [master revision
:1cefadb26:e9e2bad7251477db92ab9ebcdc010f9282dd9890] (GCC)

$ cat mutant.c
unsigned fib[];
count_fib() {
  int i;
  fib[1] = 1;
  for (i = 2; i < 1000; i++)
    fib[i] = fib[i - 1] + fib[i - 2];
}

$ gcc-trunk -O3 mutant.c
mutant.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    2 | count_fib() {
      | ^~~~~~~~~
mutant.c:1:10: warning: array ‘fib’ assumed to have one element
    1 | unsigned fib[];
      |          ^~~
mutant.c: In function ‘count_fib’:
mutant.c:6:30: warning: iteration 1 invokes undefined behavior
[-Waggressive-loop-optimizations]
    6 |     fib[i] = fib[i - 1] + fib[i - 2];
      |                           ~~~^~~~~~~
mutant.c:5:17: note: within this loop
    5 |   for (i = 2; i < 1000; i++)
      |               ~~^~~~~~
during GIMPLE pass: slp
mutant.c:2:1: internal compiler error: Segmentation fault
    2 | count_fib() {
      | ^~~~~~~~~
0xf13763 crash_signal
        /tmp/tmp.buHCZx7AOn-gcc-builder/gcc/gcc/toplev.c:327
0x11e1f55 vect_optimize_slp(vec_info*)
        /tmp/tmp.buHCZx7AOn-gcc-builder/gcc/gcc/tree-vect-slp.c:3694
0x11eb481 vect_optimize_slp(vec_info*)
        /tmp/tmp.buHCZx7AOn-gcc-builder/gcc/gcc/tree-vect-slp.c:5644
0x11eb481 vect_slp_analyze_bb_1
        /tmp/tmp.buHCZx7AOn-gcc-builder/gcc/gcc/tree-vect-slp.c:5608
0x11eb481 vect_slp_region
        /tmp/tmp.buHCZx7AOn-gcc-builder/gcc/gcc/tree-vect-slp.c:5695
0x11ec5c8 vect_slp_bbs
        /tmp/tmp.buHCZx7AOn-gcc-builder/gcc/gcc/tree-vect-slp.c:5845
0x11ec9fc vect_slp_function(function*)
        /tmp/tmp.buHCZx7AOn-gcc-builder/gcc/gcc/tree-vect-slp.c:5931
0x11f3761 execute
        /tmp/tmp.buHCZx7AOn-gcc-builder/gcc/gcc/tree-vectorizer.c:1445
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to