https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94784
Bug ID: 94784 Summary: ICE: in simplify_vector_constructor, at tree-ssa-forwprop.c:2482 Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: felix.yang at huawei dot com Target Milestone: --- Target: aarch64 I see one gcc_assert was introduce in: https://gcc.gnu.org/pipermail/gcc-patches/2020-April/544271.html It looks like this is causing an ICE when compiling the foo.c test. Gimple input to forwprop4 pass looks like: pass_v4hi (v4hi v) { vector(4) short int * vectp.4; vector(4) short int * vectp_a.3; union u4hi u; int j; short int _2; short int _3; vector(4) short int _6; short int _25; short int _26; <bb 2> [local count: 214748368]: _3 = BIT_FIELD_REF <v_5(D), 16, 0>; _2 = BIT_FIELD_REF <v_5(D), 16, 16>; _26 = BIT_FIELD_REF <v_5(D), 16, 32>; _25 = BIT_FIELD_REF <v_5(D), 16, 48>; _6 = {_3, _2, _26, _25}; <======== MEM <vector(4) short int> [(short int *)&a] = _6; <======== u ={v} {CLOBBER}; return; } Here at the crash site, we have two vector types with different modes: (gdb) p debug_tree (src_type) <vector_type 0xffffb20f73f0 v4hi type <integer_type 0xffffb22ea498 short int sizes-gimplified HI size <integer_cst 0xffffb22d0f48 constant 16> unit-size <integer_cst 0xffffb22d0f60 constant 2> align:16 warn_if_not_align:0 symtab:0 alias-set 2 canonical-type 0xffffb22ea498 precision:16 min <integer_cst 0xffffb22d0f00 -32768> max <integer_cst 0xffffb22d0f18 32767> pointer_to_this <pointer_type 0xffffb240f000>> sizes-gimplified V4HI size <integer_cst 0xffffb22d0d98 type <integer_type 0xffffb22ea0a8 bitsizetype> constant 64> unit-size <integer_cst 0xffffb22d0db0 type <integer_type 0xffffb22ea000 sizetype> constant 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0xffffb23b1690 nunits:4 context <translation_unit_decl 0xffffb20f68e8 foo.c>> $5 = void (gdb) p debug_tree (type) <vector_type 0xffffb20f7348 type <integer_type 0xffffb22ea498 short int sizes-gimplified HI size <integer_cst 0xffffb22d0f48 constant 16> unit-size <integer_cst 0xffffb22d0f60 constant 2> align:16 warn_if_not_align:0 symtab:0 alias-set 2 canonical-type 0xffffb22ea498 precision:16 min <integer_cst 0xffffb22d0f00 -32768> max <integer_cst 0xffffb22d0f18 32767> pointer_to_this <pointer_type 0xffffb240f000>> VNx2HI size <integer_cst 0xffffb22d0d98 type <integer_type 0xffffb22ea0a8 bitsizetype> constant 64> unit-size <integer_cst 0xffffb22d0db0 type <integer_type 0xffffb22ea000 sizetype> constant 8> align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0xffffb23b1690 nunits:4 pointer_to_this <pointer_type 0xffffb20f77e0>> $6 = void foo.c typedef short __attribute__((vector_size (8))) v4hi; typedef union U4HI { v4hi v; short a[4]; } u4hi; short a[4]; void pass_v4hi (v4hi v) { int j; u4hi u; u.v = v; for (j = 0; j < 4; j++) a[j] = u.a[j]; }; $ aarch64-linux-gnu-gcc -S -O2 -ftree-slp-vectorize -march=armv8.2-a+sve -msve-vector-bits=256 foo.c during GIMPLE pass: forwprop dump file: foo.c.190t.forwprop4 foo.c: In function ‘pass_v4hi’: foo.c:7:6: internal compiler error: in simplify_vector_constructor, at tree-ssa-forwprop.c:2482 7 | void pass_v4hi (v4hi v) { | ^~~~~~~~~ 0x147dbf7 simplify_vector_constructor ../../gcc-git/gcc/tree-ssa-forwprop.c:2482 0x1480a2b execute ../../gcc-git/gcc/tree-ssa-forwprop.c:3151