[PATCH] D57898: CodeGen: Fix PR40605: split constant structures generated by -ftrivial-auto-var-init when emitting initializators
Alexander Potapenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 13 02:05:40 PST 2019
glider added a comment.
Well, now we somewhat break padding initialization.
E.g. for the following struct:
struct s {
int a;
char b;
long int c;
};
we generate the following constant initializer with `-O0`:
.L__const.foo.local:
.long 2863311530 # 0xaaaaaaaa
.byte 170 # 0xaa
.zero 3
.quad -6148914691236517206 # 0xaaaaaaaaaaaaaaaa
.size .L__const.foo.local, 16
, which overwrites the padding bytes on stack, but with a wrong constant.
OTOH with `-O1` (i.e. with my patch) we generate the following sequence of stores:
movl $-1431655766, 8(%rsp) # imm = 0xAAAAAAAA
movb $-86, 12(%rsp)
movabsq $-6148914691236517206, %rax # imm = 0xAAAAAAAAAAAAAAAA
movq %rax, 16(%rsp)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57898/new/
https://reviews.llvm.org/D57898
More information about the cfe-commits
mailing list