This is the mail archive of the gcc-patches@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: Walways-true:Warn if a comparison is always true or always false due to the limited range of the data type


On 26/08/07, Rask Ingemann Lambertsen <rask@sygehus.dk> wrote:
>
>    Why do we get two different sets of warnings for the same thing in the
> first place?

First, to avoid confusion, let me say that the option is Wtype-limits
and not Walways-true. Second, the warnings were there already, I just
made them conditional on Wtype-limits.

Finally, you get two different warnings because the paths for widening
comparisons and for non-widening comparisons are different and (I
guess for historical reasons) do different things. The code is in
c-common.c (shorten_compare) and I guess it could do with a bit of
refactoring. I was not confident enough at the moment to try to clean
it up.

If you don't feel confident either to change it, perhaps you can
adjust the tests so they only match "is always true" or "is always
false".

Cheers,

Manuel.


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