sparse -Wptr-subtraction-blows: still needed?

From: Josh Triplett
Date: Tue May 01 2007 - 17:08:36 EST



Sparse has a warning -Wptr-subtraction-blows (off by default) which generates
a warning for any pointer subtractions. This warning relates to GCC
shortcomings observed in 2005; the original log message:

> commit 6889bd0f84939675c743229d6fe623513b95e057
> Author: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>
> Date: Fri Jan 7 15:06:24 2005 -0700
>
> Add option "-Wptr-subtraction-blows" to warn about expensive
> pointer subtractions.
>
> Not only does it generate bad code (that can often be rewritten
> to not do that), it also causes gcc to go into horrible contortions,
> and Al Viro reports that it can make a factor of 2.5 difference in
> kernel build times to have just a few of these in common header
> file inline functions.

Does this still apply? Do current versions of GCC still have this problem?
If not, can the option and warning go away?

- Josh Triplett

Attachment: signature.asc
Description: OpenPGP digital signature