[PATCH] D126864: [clang] Introduce -fstrict-flex-arrays for stricter handling of flexible arrays

serge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 2 02:34:19 PDT 2022


serge-sans-paille created this revision.
serge-sans-paille added reviewers: george.burgess.iv, kees.
Herald added subscribers: krytarowski, arichardson, emaste.
Herald added a project: All.
serge-sans-paille requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

Some code [0] consider that trailing arrays are flexible, whatever their size.
Support for these legacy code has been introduced in
f8f632498307d22e10fab0704548b270b15f1e1e but it prevents evaluation of
__builtin_object_size in some legit cases. Introduce -fstrict-flex-arrays to
have stricter conformance when it is desirable.

[0] https://docs.freebsd.org/en/books/developers-handbook/sockets/#sockets-essential-functions


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126864

Files:
  clang/docs/ClangCommandLineReference.rst
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/AST/ExprConstant.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CodeGen/object-size-flex-array.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126864.433693.patch
Type: text/x-patch
Size: 5068 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220602/faaaeadc/attachment.bin>


More information about the cfe-commits mailing list