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

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 3 10:02:09 PDT 2022


efriedma added a comment.

Probably IsTailPaddedMemberArray() in SemaChecking.cpp and isFlexibleArrayMemberExpr() in CGExpr.cpp should also check for this flag.  Not sure if there's anything else that does similar checks; the static analyzer has its own flag consider-single-element-arrays-as-flexible-array-members, but I think that's disabled by default anyway.

I'm a little concerned about the premise of this, though.  See https://github.com/llvm/llvm-project/issues/29694 for why we relaxed this check in the first place.  I mean, the Linux kernel itself can maybe ensure it isn't doing anything silly, but most code has to deal with system headers, which are apparently broken.  So this option is a trap for most code.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126864/new/

https://reviews.llvm.org/D126864



More information about the cfe-commits mailing list