This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC and out-of-range constant array indexes?


On Oct 8, 2010, at 18:18, Manuel López-Ibáñez wrote:

> It is possible to do it quite fast. Clang implements all warnings,
> including Wuninitialized, in the FE using fast analysis and they claim
> very low false positives.
> However, there are various reasons why it has not been attempted in GCC:
> 
> * GCC is too slow already at -O0, slowing it down further would not be
> acceptable. So you need a really high-performing implementation.

The Ada front end has very extensive warnings. I don't think
they really contribute measurably to performance.
We don't try to construct call graphs to determine
wether the array reference will be executed or not.
If the line appears in your program, it will cause an
error if executed, so we will warn: either you wrote
dead code, or wrong code.

To avoid false positives in inlined code, code instantiated
from templates and the like, we have a notion of code that
comes from source or not. For many warnings, we will only
post the warning if the code comes from source, that is:
is not generated by the compiler as part of the compilation
process.

  -Geert


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]