This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Explosion of noise from -Wall
On Aug 22 2012, Tobias Burnus wrote:
For both -Wconversion and -Wcompare-real, I am fine with a patch which
moves them from -Wall to -Wextra. The problem is that both of them are
good tools to find bugs, but both of them show many false positives -
either for nicely written code or for properly working but lazily
written code. On the other hand, flags which are not in -Wall are kind
of invisible.
I would much prefer that the -Wconversion NOT be moved! In your code,
the majority of the warnings were about complex=>real, and I have seen
that cause a lot of obscure bugs. I agree that programs often need to
do it, and REAL(<expr>,KIND=...) is a pain, but it's murder to tell if
an automatic conversion is an error when looking at someone else's code.
Quite often, the correct conversion is CABS, not REAL, for example.
Regarding -Wcompare-real, I wonder whether it makes sense to either
ignore comparisions against zero or to put them into a different flag
(-Wcompare-real-zero); those comparisons seem most of the time perfectly
valid and replacing them with "abs(a-b) < eps" is usually worse. On the
other hand, if -Wcompare-real is in -Wextra, one could also leave in the
zero-comparison warnings.
That's a good point. Unfortunately, IEEE 754 has muddied the waters by
introducing denormalised numbers, but that hasn't stopped zero being a
well-defined value in a lot of codes.
Regards,
Nick.