https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70398
Bug ID: 70398 Summary: [6 Regression] gcc.dg/vect/slp-multitypes-9.c FAILs with -fno-tree-loop-optimize -fno-tree-ter Product: gcc Version: 6.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: zsojka at seznam dot cz Target Milestone: --- Target: aarch64-unknown-linux-gnu Created attachment 38079 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38079&action=edit reduced testcase Output (qemu userspace emulation): $ aarch64-unknown-linux-gnu gcc -O -fno-tree-loop-optimize -fno-tree-ter -static testcase.c $ ./a.out qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault Crash is at: Dump of assembler code for function main: 0x0000000000400ac8 <+0>: mov w2, #0x0 // #0 0x0000000000400acc <+4>: adrp x4, 0x490000 0x0000000000400ad0 <+8>: add x4, x4, #0x10 0x0000000000400ad4 <+12>: adrp x3, 0x493000 <archive_stat+112> 0x0000000000400ad8 <+16>: add x3, x3, #0x530 0x0000000000400adc <+20>: lsl w0, w2, #1 => 0x0000000000400ae0 <+24>: ldrb w1, [x4,x5] 0x0000000000400ae4 <+28>: add w1, w1, #0x1 0x0000000000400ae8 <+32>: strb w1, [x3,w0,sxtw] x5 is never initialised. .ira has: (insn 8 7 11 3 (set (reg:SI 74 [ _5 ]) (ashift:SI (reg/v:SI 82 [ i ]) (const_int 1 [0x1]))) testcase.c:13 636 {*aarch64_ashl_sisd_or_int_si3} (nil)) (note 11 8 12 3 NOTE_INSN_DELETED) (insn 12 11 13 3 (set (reg:SI 75 [ _6 ]) (mem:SI (plus:DI (sign_extract:DI (mult:DI (subreg:DI (reg:SI 74 [ _5 ]) 0) (const_int 4 [0x4])) (const_int 34 [0x22]) (const_int 0 [0])) (reg/f:DI 102)) [1 in S4 A64])) testcase.c:13 49 {*movsi_aarch64} (expr_list:REG_EQUIV (mem:SI (plus:DI (sign_extract:DI (mult:DI (subreg:DI (reg:SI 74 [ _5 ]) 0) (const_int 4 [0x4])) (const_int 34 [0x22]) (const_int 0 [0])) (reg/f:DI 102)) [1 in S4 A64]) (nil))) (insn 13 12 14 3 (set (reg:SI 76 [ _7 ]) (zero_extend:SI (subreg:QI (reg:SI 75 [ _6 ]) 0))) testcase.c:13 90 {*zero_extendqisi2_aarch64} (expr_list:REG_DEAD (reg:SI 75 [ _6 ]) (nil))) but .reload has: (insn 8 7 11 3 (set (reg:SI 0 x0 [orig:74 _5 ] [74]) (ashift:SI (reg/v:SI 2 x2 [orig:82 i ] [82]) (const_int 1 [0x1]))) testcase.c:13 636 {*aarch64_ashl_sisd_or_int_si3} (nil)) (note 11 8 12 3 NOTE_INSN_DELETED) (note 12 11 13 3 NOTE_INSN_DELETED) (insn 13 12 14 3 (set (reg:SI 1 x1 [orig:76 _7 ] [76]) (zero_extend:SI (mem:QI (plus:DI (reg/f:DI 4 x4 [102]) (reg:DI 5 x5 [139])) [1 in S1 A64]))) testcase.c:13 90 {*zero_extendqisi2_aarch64} (nil)) .ira might be correct, but .reload is wrong. Insn 12 is deleted without any replacement (and it turns out, the same happens with insn 25) @@ -23,12 +23,14 @@ .L2: .loc 1 13 0 is_stmt 0 discriminator 3 lsl w0, w2, 1 - ldrb w1, [x4, x5] + lsl w5, w0, 2 + ldrb w1, [x4, w5, sxtw] add w1, w1, 1 strb w1, [x3, w0, sxtw] .loc 1 14 0 is_stmt 1 discriminator 3 add w0, w0, 1 - ldrb w1, [x4, x6] + lsl w6, w0, 2 + ldrb w1, [x4, w6, sxtw] add w1, w1, 2 strb w1, [x3, w0, sxtw] .loc 1 11 0 discriminator 3 fixes the asm. Tested revisions: trunk r234405 - FAIL 5-branch r234375 - OK