[cfe-dev] -Warray-bounds seems over-zealous on Clang

Nico Weber thakis at chromium.org
Tue Jul 12 12:16:06 PDT 2011


On Tue, Jul 12, 2011 at 10:29 AM, Chris Lattner <clattner at apple.com> wrote:
>
> On Jul 12, 2011, at 9:50 AM, Douglas Gregor wrote:
>
>>> 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.
>>
>> We have empirical evidence that it *does* find bugs, otherwise we wouldn't still have the warning.
>
> Do we have empirical evidence that it finds bugs in arrays with exactly 1 element?  I think we should just disable it in the case that the array has a single element.  This really is a common pattern.

FWIW, here's an example where the warning found a bug and the array
had 1 element: http://crbug.com/84851

>
> -Chris
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>




More information about the cfe-dev mailing list