This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Need suggestion about bug 68425
- From: Manuel LÃpez-IbÃÃez <lopezibanez at gmail dot com>
- To: Prasad Ghangal <prasad dot ghangal at gmail dot com>
- Cc: David Malcolm <dmalcolm at redhat dot com>, Joseph Myers <joseph at codesourcery dot com>, Prathamesh Kulkarni <prathamesh dot kulkarni at linaro dot org>, gcc Mailing List <gcc at gcc dot gnu dot org>
- Date: Sun, 3 Apr 2016 23:23:29 +0100
- Subject: Re: Need suggestion about bug 68425
- Authentication-results: sourceware.org; auth=none
- References: <CAE+uiWYLZ6ODDc3nR3zgAdxekTtSAD10Ba3pqJ4Y--FJYo5Fig at mail dot gmail dot com> <56C5D529 dot 9080700 at gmail dot com> <1455909237 dot 9333 dot 34 dot camel at redhat dot com> <CAESRpQA4_+f==EyAdre64OOcLYD2KBFFhhpyLb0Z_nrG9kfuXw at mail dot gmail dot com> <CAE+uiWaua28sLnrrVNmZo4Y0S-qJnbh-qWRQHA8prNCDuijQ4A at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1602222137340 dot 26576 at digraph dot polyomino dot org dot uk> <CAE+uiWYBPq0aWp=aA=JCDUkLATGx4MwhbEQu1+Bf2NrAyuWrrw at mail dot gmail dot com> <1457120185 dot 1637 dot 49 dot camel at redhat dot com> <CAE+uiWZ+bi0Gv+GCw+533PrcAtb4dSU5TuOjC=VkpKdOdLHQ7w at mail dot gmail dot com>
On 3 April 2016 at 16:56, Prasad Ghangal <prasad.ghangal@gmail.com> wrote:
>
> Also for
>
> int array[10];
> array[100]=10;
>
> Currently, GCC doesn't emit any warning (even with -Wall option)
>
> Wouldn't it be nice if GCC gives some warning like Clang, which gives:
>
> foo.c:4:3: warning: array index 100 is past the end of the array
> (which contains 10 elements) [-Warray-bounds]
> array[100]=10;
> ^ ~~~
Yes, it would be very nice. This is
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35587 which is quite old.
However, there is the issue of warning for code that is clearly not
executed (for example, within if(0){}). Not sure if Clang tracks that.
Cheers,
Manuel.