This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Consider single-elem arrays as FAMs by default
ClosedPublic

Authored by steakhal on Nov 24 2022, 4:41 AM.

Details

Summary

According to my measurement in https://reviews.llvm.org/D108230#3933232,
it seems like there is no drawback to enabling this analyzer-config by default.

Actually, enabling this by default would make it consistent with the
codegen of clang, which according to -fstrict-flex-arrays, assumes
by default that all trailing arrays could be FAMs, let them be of size
undefined, zero, one, or anything else.

Speaking of -fstrict-flex-arrays, in the next patch I'll deprecate
the analyzer-config FAM option in favor of that flag. That way, CSA will
always be in sync with what the codegen will think of FAMs.

So, if a new codebase sets -fstrict-flex-arrays to some value above 0,
CSA will also make sure that only arrays of the right size will be
considered as FAMs.

Diff Detail