Patchwork [Fortran] Make -Wall no longer imply -Wcompare-reals

login
register
mail settings
Submitter Tobias Burnus
Date Aug. 26, 2012, 9:38 p.m.
Message ID <503A976C.3050201@net-b.de>
Download mbox | patch
Permalink /patch/180091/
State New
Headers show

Comments

Tobias Burnus - Aug. 26, 2012, 9:38 p.m.
Dear all,

while -Wcompare-reals is a useful option to find bugs, practical 
experience and the discussion here and on c.l.f has shown that this 
option has too many false positives. Hence, it is not suitable for -Wall.

With patch, -Wall no longer implies -Wcompare-reals.

Build on x86-64-linux.
OK for the trunk?

Tobias

PS: I will update wiki/GFortran#news after the committal.
Thomas Koenig - Aug. 26, 2012, 10:29 p.m.
Hi Tobias,


> while -Wcompare-reals is a useful option to find bugs, practical
> experience and the discussion here and on c.l.f has shown that this
> option has too many false positives. Hence, it is not suitable for -Wall.

> With patch, -Wall no longer implies -Wcompare-reals.
>
> Build on x86-64-linux.
> OK for the trunk?

Please also revert the change to bessel_5.f90.

I am also currently looking at a way to include the option in -Wextra
(which I think is suitable).  We currently don't handle -Wextra in
gfortran, which makes this a bit more difficult. However, I will
only find time for this in around two weeks.

OK for trunk.

	Thomas

Patch

2012-08-26  Tobias Burnus  <burnus@net-b.de>

	* options.c (set_Wall): Don't set for -Wcompare-reals.
	* invoke.texi (-Wall, -Wcompare-reals): -Wall no longer
	implies -Wcompare-reals.

diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi
index dfd4ca7..d5fdee3 100644
--- a/gcc/fortran/invoke.texi
+++ b/gcc/fortran/invoke.texi
@@ -727,7 +727,7 @@  warnings.
 Enables commonly used warning options pertaining to usage that
 we recommend avoiding and that we believe are easy to avoid.
 This currently includes @option{-Waliasing}, @option{-Wampersand},
-@option{-Wconversion}, @option{-Wcompare-reals}, @option{-Wsurprising},
+@option{-Wconversion}, @option{-Wsurprising},
 @option{-Wintrinsics-std}, @option{-Wno-tabs}, @option{-Wintrinsic-shadow},
 @option{-Wline-truncation}, @option{-Wtarget-lifetime},
 @option{-Wreal-q-constant} and @option{-Wunused}.
@@ -939,7 +939,6 @@  allocatable variable; this includes scalars and derived types.
 @item -Wcompare-reals
 @opindex @code{Wcompare-reals}
 Warn when comparing real or complex types for equality or inequality.
-Enabled by @option{-Wall}.
 
 @item -Wtarget-lifetime
 @opindex @code{Wtargt-lifetime}
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index cbec705..764f570 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -475,7 +475,6 @@  set_Wall (int setting)
   gfc_option.warn_character_truncation = setting;
   gfc_option.warn_real_q_constant = setting;
   gfc_option.warn_unused_dummy_argument = setting;
-  gfc_option.warn_compare_reals = setting;
   gfc_option.warn_target_lifetime = setting;
 
   warn_return_type = setting;