[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-patches
Subject:    Re: [PATCH][RFC] Add a subset of -Warray-bounds warnings to C/C++ front ends
From:       "Andrew Pinski" <pinskia () gmail ! com>
Date:       2008-04-10 17:53:43
Message-ID: de8d50360804101053i4f3bd784g516fb15742c6589e () mail ! gmail ! com
[Download RAW message or body]

On Fri, Apr 4, 2008 at 4:50 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>  This is just a semi fake example (glibc does something like this for
>  one of the str* functions, I forget which one) where define comes up
>  with out of bounds array references in dead code.

I was reported an example of where this happens (even currently but
that is a different issue):
From #gcc:

[10:44:57] < ryanarn> So is this actually bad form in C? strcmp (arg,
"no");?  GCC 4.3 warns by default now.  It should be:char no[]=
"no\0"; strcmp(arg,no);?
[10:45:33] < apinski> what is the warning about?
[10:46:01] < ryanarn> warning: array subscript is above array bounds
[10:46:09] < apinski> false warnings
[10:46:13] < apinski> due to glibc
[10:46:34] < apinski> this is why I mentioned about why we should not
move these warnings to the front-end
[10:46:55] < ryanarn> apinski: well this is in glibc's libm-test.c

So if you want to test for the warning, please try running make check
with glibc also and not just building it.  Also try compiling glibc
2.6.x instead of 2.4.x or better yet the trunk of glibc where I think
Ryan found these warnings.

Thanks,
Andrew Pinski
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic