[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:       Mark Mitchell <mark () codesourcery ! com>
Date:       2008-05-02 14:06:21
Message-ID: 481B1FDD.3030504 () codesourcery ! com
[Download RAW message or body]

H.J. Lu wrote:

> A side effect of copying these warnings up into the language frontends is
> that warnings are now printed even if the array access is in dead or
> inaccessible code.

We've had this discussion for years.  The arguments are:

1. Users only care about problems that actually affect their build.  Let 
the optimizers do their thing and warn about problems that are detected 
that way.  This avoids warning about things in dead code, and it results 
in warnings that occur after (say) simplifications from inlining.

2. Users care about problems that might occur when building their code 
in some different mode.  Users want the same warnings across platforms, 
and whether optimizing or not.  Thus, we should emit warnings only from 
front ends, without trying to avoid dead code, and without doing a lot 
of transformation on the code.

GCC has traditionally done (1).  I've argued for (2), which is what most 
compilers do.  Simon's patch makes it do a bit of (2), while still doing 
(1).  This seems to me like a reasonable compromise; you give up none of 
the warnings in (1), but still get many of the benefits of (2).

Obviously, Simon needs to fix the bootstrap issue.  But, I don't see a 
fundamental problem with the patch -- at least not yet.

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713
[prev in list] [next in list] [prev in thread] [next in thread] 

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