[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Having fun with the following C code (UB)



On 2014-04-15 10:17:04 -0700, Russ Allbery wrote:
> Vincent Lefevre <vincent@vinc17.net> writes:
> > Andrew Pinski said: "For the first warning, even though the warning is
> > correct, I don't think we should warn here as the expressions are split
> > between two different statements.", which is more or less my point here
> > (the first overflow occurs before the "m >= 0").
> 
> Well, I strongly disagree for the reasons I stated in my previous message.
> *shrug*

Due to excessive warnings, developers no longer look at them, disable
them, or worse, try to avoid them by modifying valid code to invalid
code (with UB).

Anyway the right solution would be to make GCC use VRP information
for these warnings. Developers can already provide preconditions
(which can either be checked via assertions or be hints thanks to
__builtin_unreachable(), as done by MPFR).

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


Reply to: