[PATCH] D134902: [clang] Implement -fstrict-flex-arrays=3
Bill Wendling via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 29 13:43:17 PDT 2022
void created this revision.
void added a reviewer: kees.
Herald added a project: All.
void requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
The -fstrict-flex-arrays=3 is the most restrictive type of flex arrays.
No number, including 0, is allowed in the FAM. In the cases where a "0"
is used, the resulting size is the same as if a zero-sized object were
substituted.
This is needed for proper _FORTIFY_SOURCE coverage in the Linux kernel,
among other reasons. So while the only reason for specifying a
zero-length array at the end of a structure is for specify a FAM,
treating it as such will cause _FORTIFY_SOURCE not to work correctly.
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D134902
Files:
clang/include/clang/Driver/Options.td
clang/lib/AST/ExprConstant.cpp
clang/lib/CodeGen/CGExpr.cpp
clang/test/CodeGen/bounds-checking-fam.c
clang/test/CodeGen/object-size-flex-array.c
clang/test/Sema/array-bounds-ptr-arith.c
clang/test/SemaCXX/array-bounds-strict-flex-arrays.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134902.464013.patch
Type: text/x-patch
Size: 12989 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220929/ea5df4a7/attachment.bin>
More information about the cfe-commits
mailing list