https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110459
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Actually the problem is not what is listed in comment #2 at all but rather
the expansion of
;; MEM <char[3]> [(struct array *)&buffer + 1B] = {};
Being so bad.
```
(insn 6 5 7 (set (mem/c:HI (plus:DI (reg/f:DI 93 virtual-stack-vars)
(const_int -16 [0xfffffffffffffff0])) [0 S2 A128])
(const_int 0 [0])) "/app/example.cpp":7:9 -1
(nil))
(insn 7 6 9 (set (mem/c:QI (plus:DI (reg/f:DI 93 virtual-stack-vars)
(const_int -14 [0xfffffffffffffff2])) [0 S1 A16])
(const_int 0 [0])) "/app/example.cpp":7:9 -1
(nil))
(insn 9 7 10 (set (reg:SI 105)
(mem/c:SI (plus:DI (reg/f:DI 93 virtual-stack-vars)
(const_int -16 [0xfffffffffffffff0])) [0 S4 A128]))
"/app/example.cpp":7:9 -1
(nil))
(insn 10 9 11 (parallel [
(set (reg:SI 104)
(and:SI (reg:SI 105)
(const_int 16777215 [0xffffff])))
(clobber (reg:CC 17 flags))
]) "/app/example.cpp":7:9 -1
(expr_list:REG_EQUAL (and:SI (mem/c:SI (plus:DI (reg/f:DI 93
virtual-stack-vars)
(const_int -16 [0xfffffffffffffff0])) [0 S4 A128])
(const_int 16777215 [0xffffff]))
(nil)))
(insn 11 10 12 (parallel [
(set (reg:SI 106)
(ashift:SI (reg:SI 104)
(const_int 8 [0x8])))
(clobber (reg:CC 17 flags))
]) "/app/example.cpp":7:9 -1
(nil))
(insn 12 11 13 (set (reg:SI 107)
(zero_extend:SI (subreg:QI (reg/v:SI 99 [ bufferD.3003 ]) 0)))
"/app/example.cpp":7:9 -1
(nil))
(insn 13 12 14 (parallel [
(set (reg:SI 108)
(ior:SI (reg:SI 107)
(reg:SI 106)))
(clobber (reg:CC 17 flags))
]) "/app/example.cpp":7:9 -1
(nil))
(insn 14 13 0 (set (reg/v:SI 99 [ bufferD.3003 ])
(reg:SI 108)) "/app/example.cpp":7:9 -1
(nil))
```
Note:
```
auto sample2(char c) {
array buffer = {0, 0, 0, 0};
buffer.data[0] = c;
return buffer;
}
```
is just as bad:
movl .LC0(%rip), %eax
movb %dil, %al
LC0 is just 0s.