public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/19999] New: -Wfloat-equal does not warn for complex numbers
@ 2005-02-16 14:30 jsm28 at gcc dot gnu dot org
  2005-02-16 14:56 ` [Bug c/19999] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 5+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2005-02-16 14:30 UTC (permalink / raw)
  To: gcc-bugs

-Wfloat-equal warns for comparison of real floating-point numbers,
but not for complex numbers.

double a, b;
_Complex double c, d;
int f(void) { return a == b; }
int g(void) { return c == d; }

warns for the comparison in f, but not for that in g.

-- 
           Summary: -Wfloat-equal does not warn for complex numbers
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jsm28 at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c/19999] -Wfloat-equal does not warn for complex numbers
  2005-02-16 14:30 [Bug c/19999] New: -Wfloat-equal does not warn for complex numbers jsm28 at gcc dot gnu dot org
@ 2005-02-16 14:56 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-16 14:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-16 06:48 -------
Confirmed, it is easy to see where the problem is when we look at the source:
      if (warn_float_equal && (code0 == REAL_TYPE || code1 == REAL_TYPE))
        warning ("comparing floating point with == or != is unsafe");

We should not be using == REAL_TYPE but FLOAT_TYPE_P instead which also takes into account vectors 
too (even though we don't define equality for vectors yet).

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2005-02-16 06:48:38
               date|                            |


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


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

* [Bug c/19999] -Wfloat-equal does not warn for complex numbers
       [not found] <bug-19999-230@http.gcc.gnu.org/bugzilla/>
  2008-02-21  6:30 ` rwild at gcc dot gnu dot org
  2008-02-22  6:19 ` rwild at gcc dot gnu dot org
@ 2008-02-22  6:19 ` rwild at gcc dot gnu dot org
  2 siblings, 0 replies; 5+ messages in thread
From: rwild at gcc dot gnu dot org @ 2008-02-22  6:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from rwild at gcc dot gnu dot org  2008-02-22 06:19 -------
Fixed in 4.4.


-- 

rwild at gcc dot gnu dot org changed:

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


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


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

* [Bug c/19999] -Wfloat-equal does not warn for complex numbers
       [not found] <bug-19999-230@http.gcc.gnu.org/bugzilla/>
  2008-02-21  6:30 ` rwild at gcc dot gnu dot org
@ 2008-02-22  6:19 ` rwild at gcc dot gnu dot org
  2008-02-22  6:19 ` rwild at gcc dot gnu dot org
  2 siblings, 0 replies; 5+ messages in thread
From: rwild at gcc dot gnu dot org @ 2008-02-22  6:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rwild at gcc dot gnu dot org  2008-02-22 06:18 -------
Subject: Bug 19999

Author: rwild
Date: Fri Feb 22 06:17:46 2008
New Revision: 132540

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132540
Log:
gcc/:
PR c/19999
* c-typeck.c (build_binary_op): Warn about floating point
comparisons if FLOAT_TYPE_P, not only for REAL_TYPE.

gcc/cp/:
* typeck.c (build_binary_op): Warn about floating point
comparisons if FLOAT_TYPE_P, not only for REAL_TYPE.

gcc/testsuite/:
* gcc.dg/Wfloat-equal-1.c: New.
* g++.dg/warn/Wfloat-equal-1.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/warn/Wfloat-equal-1.C
    trunk/gcc/testsuite/gcc.dg/Wfloat-equal-1.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-typeck.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c/19999] -Wfloat-equal does not warn for complex numbers
       [not found] <bug-19999-230@http.gcc.gnu.org/bugzilla/>
@ 2008-02-21  6:30 ` rwild at gcc dot gnu dot org
  2008-02-22  6:19 ` rwild at gcc dot gnu dot org
  2008-02-22  6:19 ` rwild at gcc dot gnu dot org
  2 siblings, 0 replies; 5+ messages in thread
From: rwild at gcc dot gnu dot org @ 2008-02-21  6:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rwild at gcc dot gnu dot org  2008-02-21 06:29 -------
patch at <http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00897.html>


-- 

rwild at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Ralf dot Wildenhues at gmx
                   |                            |dot de
   Last reconfirmed|2005-12-18 01:40:38         |2008-02-21 06:29:50
               date|                            |


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


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

end of thread, other threads:[~2008-02-22  6:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-16 14:30 [Bug c/19999] New: -Wfloat-equal does not warn for complex numbers jsm28 at gcc dot gnu dot org
2005-02-16 14:56 ` [Bug c/19999] " pinskia at gcc dot gnu dot org
     [not found] <bug-19999-230@http.gcc.gnu.org/bugzilla/>
2008-02-21  6:30 ` rwild at gcc dot gnu dot org
2008-02-22  6:19 ` rwild at gcc dot gnu dot org
2008-02-22  6:19 ` rwild at gcc dot gnu dot org

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).