[cfe-dev] -Warray-bounds seems over-zealous on Clang
joerg at britannica.bec.de
Tue Jul 12 09:45:06 PDT 2011
On Tue, Jul 12, 2011 at 04:54:05PM +0100, Peter Geoghegan wrote:
> Saying "just use C99" isn't a practical solution. This is a mature
> project with a large codebase, that targets many compilers, including,
> for a large number of reasons, Visual Studio - Microsoft have
> absolutely no interest in pursuing C99 support.
Then disable the warning. It's an option for a reason.
> Besides, the chances of Clang actually helpfully diagnosing a problem
> with the delta between how GCC does -Warray-bounds and how Clang does
> it are slim - how often are these problems statically detectable? This
> is C.
I know at least one bug found with handling of  sized arrays and GCC
4.5 warned about that too.
> Even if your position wasn't unreasonable, which it is, Clang still
> gives this warning when the -c89 flag is given.
Just because you don't agree doesn't make it unreasonable. The behavior
of the code doesn't change with the standard level -- you are still
declaring an array and overflowing it.
More information about the cfe-dev