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?


Gary Funck <gary@intrepid.com> writes:

> 2) Expensive warnings (-Wall, -Warray-bounds, -Wuninitialized, -Wunused)
> [not sure about the actual list] that require optimizations, will issue
> a Warning when they are requested, but the appropriate optimization level
> has not been asserted, that is required for those warnings to work in their
> maximal fashion.
>
> Or:
>
> Specification of the expensive warnings will cause appropriate
> control flow computations that are required to support those
> warning levels. (as suggested previously)

I think both of those alternatives would be surprising and easily
misunderstood behaviour for many compiler users.  The first means that
you have to use different warnings at different optimization levels, or
you need to use some mechanism to disable the default warning.  The
second means that adding a warning option could have a significant
effect on compile time, which is surprising.

My current thinking is that the following should be followed by all
warnings:

* They should be entirely independent of optimization level, or

* They should warn specifically about the consequences of some easily
  misunderstood optimization, or

* They should always be true positives.

Almost all current warnings already meet those requirements; the main
problem child is -Wuninitialized.

Ian


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