[all-commits] [llvm/llvm-project] 4802ed: Fix size of flexible array initializers, and re-en...
Eli Friedman via All-commits
all-commits at lists.llvm.org
Fri Apr 15 12:10:14 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 4802edd1ac7a5aea8c8488b5baec221d722cbdde
https://github.com/llvm/llvm-project/commit/4802edd1ac7a5aea8c8488b5baec221d722cbdde
Author: Eli Friedman <efriedma at quicinc.com>
Date: 2022-04-15 (Fri, 15 Apr 2022)
Changed paths:
M clang/include/clang/AST/Decl.h
M clang/lib/AST/Decl.cpp
M clang/lib/CodeGen/CGDecl.cpp
M clang/lib/CodeGen/CGExprConstant.cpp
M clang/lib/CodeGen/CodeGenModule.cpp
M clang/test/CodeGen/flexible-array-init.c
M clang/test/CodeGenCXX/flexible-array-init.cpp
Log Message:
-----------
Fix size of flexible array initializers, and re-enable assertions.
In D123649, I got the formula for getFlexibleArrayInitChars slightly
wrong: the flexible array elements can be contained in the tail padding
of the struct. Fix the formula to account for that.
With the fixed formula, we run into another issue: in some cases, we
were emitting extra padding for flexible arrray initializers. Fix
CGExprConstant so it uses a packed struct when necessary, to avoid this
extra padding.
Differential Revision: https://reviews.llvm.org/D123826
More information about the All-commits
mailing list