[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
Tue Sep 13 15:03:27 PDT 2022
efriedma added a comment.
Oh, so you mean we need to consider whether we need to avoid emitting an error message when we're dealing with C++ code targeting i686-pc-win32, given we implement the alignment quirk. I think I'd like to try printing an error message, given it's reasonably likely you'll actually end up with a miscompile if you use an array like that. This might cause breakage, but I don't see a good alternative. (We don't try to mitigate the possibility of misaligned operations in clang, so LLVM will see misaligned operations, so LLVM optimizations will likely mess up the code. MSVC gets away with this because it doesn't really do alignment-based optimizations.)
For the gcc 10 vs. 11 thing, not sure how many people will notice. The most likely possibility here is that someone tried to align a struct, but put the attribute in the wrong place. Maybe we want a diagnostic note to point out this usage.
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