[PATCH] D126864: [clang] Introduce -fstrict-flex-arrays=<n> for stricter handling of flexible arrays
serge via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 29 05:49:19 PDT 2022
serge-sans-paille updated this revision to Diff 440942.
serge-sans-paille added a subscriber: chandlerc.
serge-sans-paille added a comment.
Code updated to take into account two situations:
- size resulting from macro expansion. Previous behavior was inconsistent in that situation. I chose to consider that `int a[1]` and `int a[N]` where N is a macro definition both are FAM. That's GCC behavior too. CCing @chandlerc because he introduced that feature, probably because that could make an array a FAM just based on preprocessor flag (?)
- FAM within non-standard layout C++ object. GCC allows that behavior and clang used to have an inconsistent approach here. I'd like to stick to GCC behavior.
Note that we still diverge from GCC behavior for `int a[N]` when `N` results from template expansion. I could revert that too.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126864/new/
https://reviews.llvm.org/D126864
Files:
clang/docs/ClangCommandLineReference.rst
clang/docs/ReleaseNotes.rst
clang/include/clang/AST/Expr.h
clang/include/clang/Basic/LangOptions.def
clang/include/clang/Driver/Options.td
clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
clang/lib/AST/Expr.cpp
clang/lib/AST/ExprConstant.cpp
clang/lib/CodeGen/CGExpr.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Sema/SemaChecking.cpp
clang/lib/StaticAnalyzer/Core/MemRegion.cpp
clang/test/CodeGen/bounds-checking-fam.c
clang/test/CodeGen/bounds-checking-fam.cpp
clang/test/CodeGen/bounds-checking.c
clang/test/CodeGen/object-size-flex-array.c
clang/test/CodeGenObjC/ubsan-array-bounds.m
clang/test/Sema/array-bounds-ptr-arith.c
clang/test/SemaCXX/array-bounds-strict-flex-arrays.cpp
clang/test/SemaCXX/array-bounds.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126864.440942.patch
Type: text/x-patch
Size: 25898 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220629/125d127c/attachment-0001.bin>
More information about the cfe-commits
mailing list