public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/56887] New: Test for equality of reals now flagged with a warning
@ 2013-04-08 23:23 fkrogh#gcc at mathalacarte dot com
  2013-04-09 11:24 ` [Bug fortran/56887] " tkoenig at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: fkrogh#gcc at mathalacarte dot com @ 2013-04-08 23:23 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56887

             Bug #: 56887
           Summary: Test for equality of reals now flagged with a warning
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: fkrogh#gcc@mathalacarte.com


This is not a bug, but is a nuisance.  I like to compile with  -Wall -Wextra
and after starting to use 4.8.0, tests for equality between reals is flagged
with a warning.  Perhaps you consider it a bad habit to assign small integer
values (usually 0) to real variables and and occasionally test for equality on
those.  For me this warning is a nuisance, and I would like a way to turn it
off without losing the benefits of -WALL and -Wextra.  Alternatively just have
it work as it did in the 4.7 series.
Thanks,
   Fred


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/56887] Test for equality of reals now flagged with a warning
  2013-04-08 23:23 [Bug fortran/56887] New: Test for equality of reals now flagged with a warning fkrogh#gcc at mathalacarte dot com
@ 2013-04-09 11:24 ` tkoenig at gcc dot gnu.org
  2013-04-09 13:06 ` burnus at gcc dot gnu.org
  2013-04-09 13:30 ` fkrogh at mathalacarte dot com
  2 siblings, 0 replies; 4+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2013-04-09 11:24 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56887

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |tkoenig at gcc dot gnu.org
         Resolution|                            |INVALID

--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2013-04-09 11:24:07 UTC ---
Please see the release notes:

"The -Wcompare-reals command-line option has been added. When this is set,
warnings are issued when comparing REAL or COMPLEX types for equality and
inequality; consider replacing a == b by abs(a−b) < eps with a suitable eps.
-Wcompare-reals is enabled by -Wextra."

Following the usual gcc option conventions, you can disable the -Wcompare-reals
 flag by -Wno-compare-reals.
>From gcc-bugs-return-419588-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Apr 09 11:47:18 2013
Return-Path: <gcc-bugs-return-419588-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 22714 invoked by alias); 9 Apr 2013 11:47:18 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 22650 invoked by uid 48); 9 Apr 2013 11:47:15 -0000
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/51348] [c++0x] ICE in finish_class_member_access_expr with enum class use
Date: Tue, 09 Apr 2013 11:47:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Keywords: ice-on-valid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: paolo.carlini at oracle dot com
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields: Status Resolution
Message-ID: <bug-51348-4-Mt7egvVEPT@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-51348-4@http.gcc.gnu.org/bugzilla/>
References: <bug-51348-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
MIME-Version: 1.0
X-SW-Source: 2013-04/txt/msg00733.txt.bz2
Content-length: 537


http://gcc.gnu.org/bugzilla/show_bug.cgi?idQ348

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-04-09 11:47:15 UTC ---
Dup.

*** This bug has been marked as a duplicate of bug 56793 ***


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/56887] Test for equality of reals now flagged with a warning
  2013-04-08 23:23 [Bug fortran/56887] New: Test for equality of reals now flagged with a warning fkrogh#gcc at mathalacarte dot com
  2013-04-09 11:24 ` [Bug fortran/56887] " tkoenig at gcc dot gnu.org
@ 2013-04-09 13:06 ` burnus at gcc dot gnu.org
  2013-04-09 13:30 ` fkrogh at mathalacarte dot com
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-04-09 13:06 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56887

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-04-09 13:06:15 UTC ---
(In reply to comment #0)
> tests for equality between reals is flagged with a warning.

The support for the warning follows ISO/IEC TR 24772, which recommends users to
"Avoid creating a logical value from a test for equality or inequality
between two floating-point expressions." - And compiler vendors to provide such
a warning.

The problem with many constructs is that one cannot reliably detect whether
they are okay or a bug in the code. Thus, warnings are issued for those; there
are always false positives and missed bugs with warning diagnostic. Those
checks, where the false-positive rate is low and the likelihood for bugs is
high, are enabled by default; others only with -Wall or -Wextra or only with
-W<name-of-the-warning>.

In your case, using integer-valued floating-point numbers is probably fine. As
Thomas wrote, you can use -Wno-compare-reals to disable the warning. See GCC
4.8 release notes or gfortran's man page (or user manual) under -Wextra.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/56887] Test for equality of reals now flagged with a warning
  2013-04-08 23:23 [Bug fortran/56887] New: Test for equality of reals now flagged with a warning fkrogh#gcc at mathalacarte dot com
  2013-04-09 11:24 ` [Bug fortran/56887] " tkoenig at gcc dot gnu.org
  2013-04-09 13:06 ` burnus at gcc dot gnu.org
@ 2013-04-09 13:30 ` fkrogh at mathalacarte dot com
  2 siblings, 0 replies; 4+ messages in thread
From: fkrogh at mathalacarte dot com @ 2013-04-09 13:30 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56887

--- Comment #3 from fkrogh at mathalacarte dot com 2013-04-09 13:30:45 UTC ---
On 04/09/2013 06:06 AM, burnus at gcc dot gnu.org wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56887
>
> Tobias Burnus <burnus at gcc dot gnu.org> changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |burnus at gcc dot gnu.org
>
> --- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2013-04-09 13:06:15 UTC ---
> (In reply to comment #0)
>> tests for equality between reals is flagged with a warning.
> The support for the warning follows ISO/IEC TR 24772, which recommends users to
> "Avoid creating a logical value from a test for equality or inequality
> between two floating-point expressions." - And compiler vendors to provide such
> a warning.
>
> The problem with many constructs is that one cannot reliably detect whether
> they are okay or a bug in the code. Thus, warnings are issued for those; there
> are always false positives and missed bugs with warning diagnostic. Those
> checks, where the false-positive rate is low and the likelihood for bugs is
> high, are enabled by default; others only with -Wall or -Wextra or only with
> -W<name-of-the-warning>.
>
> In your case, using integer-valued floating-point numbers is probably fine. As
> Thomas wrote, you can use -Wno-compare-reals to disable the warning. See GCC
> 4.8 release notes or gfortran's man page (or user manual) under -Wextra.
>

Many thanks Tobias.  That works fine for me and is just what I wanted.  
For some reason it is not in my info pages or man pages -- I really did 
look for anything like this.

On another subject, I know that you had some contact with Dr. Richard 
Hanson concerning IEEE exceptions.  He has completed his work on these 
and is free to tun them over to GNU.  He is under the impression that 
there is no interest on your part.

Thanks again,
    Fred


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-04-09 13:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-08 23:23 [Bug fortran/56887] New: Test for equality of reals now flagged with a warning fkrogh#gcc at mathalacarte dot com
2013-04-09 11:24 ` [Bug fortran/56887] " tkoenig at gcc dot gnu.org
2013-04-09 13:06 ` burnus at gcc dot gnu.org
2013-04-09 13:30 ` fkrogh at mathalacarte dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).