[patch, fortran] Warning for feal / complex equality / inequality comparisons

Thomas Koenig tkoenig@netcologne.de
Sun Aug 19 10:32:00 GMT 2012


Hello world,

the attached patch warns about comparisions for equality and inequality
of real and complex values if -Wcompare-reals is given. The new
compiler option is included in -Wall.

Regression-tested, tested with "make info" and "make dvi".

OK for trunk?

	Thomas

2012-08-19  Thomas König  <tkoenig@gcc.gnu.org>

         PR fortran/54298
         * gfortran.h (struct gfc_option_t): Add warn_compare_reals.
         * lang.opt:  Add Wcompare-reals.
         * invoke.texi:  Document -Wcompare-reals.
         * resolve.c (resolve_operator):  If -Wcompare-reals is in effect,
         warn about equality/inequality comparisions for REAL and COMPLEX.
         * options.c (gfc_init_options):  Set warn_compare_reals.
         (set_Wall):  Include warn_compare_reals in Wall.
         (gfc_handle_option):  Handle Wcompare_reals.

2012-08-19  Thomas König  <tkoenig@gcc.gnu.org>

         PR fortran/54298
         * gfortran.dg/real_compare_1.f90:  New test case.
         * gfortran.dg/bessel_5.f90  Add -Wno-compare-reals to options.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p2.diff
Type: text/x-patch
Size: 4695 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20120819/efa7e40f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: real_compare_1.f90
Type: text/x-fortran
Size: 1148 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20120819/efa7e40f/attachment-0001.bin>


More information about the Fortran mailing list