Martin Jambor <[EMAIL PROTECTED]> writes:

> I've been  rebootstrapping my switch conversion patch  (which is still
> waiting for  review) to make  sure it still works.   Unfortunately, it
> did not.  The error given was  the following and I believe this is the
> warning introduced by Ian as a response to the infamous CERT advisory.
> (Furthermore, I am  getting this warning at revision  134664 but I was
> not getting it at 134135.)
>
> ------- Compiler output -------
> /cswtch/gcc/. -I/abuild/mjambor/cswtch/gcc/../include 
> -I/abuild/mjambor/cswtch/gcc/../libcpp/include  
> -I/abuild/mjambor/cswtch/gcc/../libdecnumber 
> -I/abuild/mjambor/cswtch/gcc/../libdecnumber/bid -I../libdecnumber  
> /abuild/mjambor/cswtch/gcc/tree-switch-conversion.c -o 
> tree-switch-conversion.o
> cc1: warnings being treated as errors
> /abuild/mjambor/cswtch/gcc/tree-switch-conversion.c: In function 
> 'process_switch':
> /abuild/mjambor/cswtch/gcc/tree-switch-conversion.c:182: error: assuming 
> signed overflow does not occur when assuming that (X - c) > X is always false
> make[3]: *** [tree-switch-conversion.o] Error 1
> ------------- End -------------

The warnings I added for the CERT advisory say "assuming pointer
wraparound does not occur"....  You are running into one of the older
signed overflow warnings.

>   1. Am I doing something wrong?

No.

>   2. How can I get rid of the error and bootstrap my code? 

Make branch_num an unsigned int.

>   3. If the warning is really bogus, should we perhaps turn it off for
>      bootstrap, (or  turn it  off by default  in general and  leave it
>      there for people who want  to check their code after reading CERT
>      advisories)?

The basic criteria for -Wall is: could indicate a problem, easy to
rewrite code to avoid.  You've encountered a false positive, but it's
easy to avoid.

Ian

Reply via email to