Bug 98308

Summary: [11 Regression] ICE in vect_slp_analyze_node_operations, at tree-vect-slp.c:3764 with -O3 -march=skylake-avx512 since r11-615-gdc0c0196340f7ac5
Product: gcc Reporter: Vsevolod Livinskii <vsevolod.livinskiy>
Component: tree-optimizationAssignee: Richard Biener <rguenth>
Status: RESOLVED FIXED    
Severity: normal CC: babokin, marxin, regehr, rguenth, vsevolod.livinskiy
Priority: P1 Keywords: ice-on-valid-code
Version: 11.0   
Target Milestone: 11.0   
Host: Target:
Build: Known to work: 10.2.0
Known to fail: 11.0 Last reconfirmed: 2020-12-16 00:00:00
Bug Depends on:    
Bug Blocks: 103035    

Description Vsevolod Livinskii 2020-12-16 05:16:23 UTC
Reproducer:
extern unsigned long long int arr_86[];
extern unsigned long long int arr_87[][15];

void test(bool a, unsigned short c[][15], unsigned char d[]) {
    for (short h = 0; h < 10; h++)
        for (char i = 0; i < 15; i += 2) {
            arr_86[0] = d[0];
            arr_87[h][0] = a ? c[h][i] : 0;
        }
}

Error:
>$ g++ -c -O3 -march=skylake-avx512 func.cpp
during GIMPLE pass: vect
func.cpp: In function ‘void test(bool, short unsigned int (*)[15], unsigned char*)’:
func.cpp:4:6: internal compiler error: in vect_slp_analyze_node_operations, at tree-vect-slp.c:3764
    4 | void test(bool a, unsigned short c[][15], unsigned char d[]) {
      |      ^~~~
0x886a4d vect_slp_analyze_node_operations
	gcc_src/gcc/tree-vect-slp.c:3764
0x1425a73 vect_slp_analyze_node_operations
	gcc_src/gcc/tree-vect-slp.c:3719
0x1425a73 vect_slp_analyze_node_operations
	gcc_src/gcc/tree-vect-slp.c:3719
0x1425a73 vect_slp_analyze_node_operations
	gcc_src/gcc/tree-vect-slp.c:3719
0x1427101 vect_slp_analyze_operations(vec_info*)
	gcc_src/gcc/tree-vect-slp.c:3914
0x1404939 vect_analyze_loop_2
	gcc_src/gcc/tree-vect-loop.c:2391
0x1404939 vect_analyze_loop(loop*, vec_info_shared*)
	gcc_src/gcc/tree-vect-loop.c:2929
0x14311f4 try_vectorize_loop_1
	gcc_src/gcc/tree-vectorizer.c:1008
0x1431c59 vectorize_loops()
	gcc_src/gcc/tree-vectorizer.c:1242
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.

gcc version 11.0.0 20201214 (22a90217305ee8c116bbc12c8d07abe7ca0ff61d)
Comment 1 Martin Liška 2020-12-16 08:29:08 UTC
Confirmed, started with r11-615-gdc0c0196340f7ac5.
Comment 2 Richard Biener 2021-01-04 08:58:07 UTC
Mine.
Comment 3 GCC Commits 2021-01-04 13:39:23 UTC
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:9e79d76a16c56df0f838b9aede69c0a158203f56

commit r11-6444-g9e79d76a16c56df0f838b9aede69c0a158203f56
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Jan 4 13:25:35 2021 +0100

    tree-optimization/98308 - set vector type for mask of masked load
    
    This makes sure to set the vector type on an invariant mask argument
    for a masked load and SLP.
    
    2021-01-04  Richard Biener  <rguenther@suse.de>
    
            PR tree-optimization/98308
            * tree-vect-stmts.c (vectorizable_load): Set invariant mask
            SLP vectype.
    
            * gcc.dg/vect/pr98308.c: New testcase.
Comment 4 Richard Biener 2021-01-04 13:39:37 UTC
Fixed.