[PATCH] D133711: [Sema] Reject array element types whose alignments are larger than their sizes
Eli Friedman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 12 10:44:33 PDT 2022
efriedma added a reviewer: aaron.ballman.
efriedma added inline comments.
================
Comment at: clang/lib/Sema/SemaType.cpp:2406
+
+ if (Size.isZero() || Size >= Context.getTypeAlignInChars(EltTy))
+ return false;
----------------
I think you need to check that the size is a multiple of the alignment, not just larger than the alignment. (Those are only the same thing if the size is a power of two; it looks like you don't have any test coverage for non-power-of-two sizes.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133711/new/
https://reviews.llvm.org/D133711
More information about the cfe-commits
mailing list