[PATCH] D79052: [clang codegen] Fix alignment of "Address" for incomplete array pointer.
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 28 16:45:48 PDT 2020
rsmith added inline comments.
================
Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:176
CharUnits Alignment;
- if (T->isIncompleteType()) {
+ if (T->getBaseElementTypeUnsafe()->isIncompleteType()) {
Alignment = CharUnits::One(); // Shouldn't be used, but pessimistic is best.
----------------
I don't know if it matters in practice, but this is still wrong. An incomplete type can have a known alignment, for a case like `struct alignas(32) S;`. Perhaps we should remove this test entirely and call `getTypeAlignIfKnown` instead of `getTypeAlign[InChars]` below.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79052/new/
https://reviews.llvm.org/D79052
More information about the cfe-commits
mailing list