public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/21438] Warning about division by zero depends on lexical form
       [not found] <bug-21438-4@http.gcc.gnu.org/bugzilla/>
@ 2021-09-28  8:25 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-28  8:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21438

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org
   Last reconfirmed|2005-12-18 01:45:12         |2021-9-28
      Known to fail|                            |

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #5)
> Subject: Bug 21438

The only thing this patch did was uniformed the code between the front-ends.

I am going to look into fix this once and for all.
GCC is the only compiler which warns for this case even.

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

* [Bug c/21438] Warning about division by zero depends on lexical form
       [not found] <bug-21438-6@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2007-03-14 18:38 ` manu at gcc dot gnu dot org
@ 2007-03-14 18:39 ` manu at gcc dot gnu dot org
  3 siblings, 0 replies; 7+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-03-14 18:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from manu at gcc dot gnu dot org  2007-03-14 18:39 -------
This is still not fixed. It needs to be re-examined what the proper fix (if
any) should be.


-- 


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


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

* [Bug c/21438] Warning about division by zero depends on lexical form
       [not found] <bug-21438-6@http.gcc.gnu.org/bugzilla/>
  2007-01-16  0:57 ` patchapp at dberlin dot org
  2007-03-12  1:32 ` patchapp at dberlin dot org
@ 2007-03-14 18:38 ` manu at gcc dot gnu dot org
  2007-03-14 18:39 ` manu at gcc dot gnu dot org
  3 siblings, 0 replies; 7+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-03-14 18:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from manu at gcc dot gnu dot org  2007-03-14 18:37 -------
Subject: Bug 21438

Author: manu
Date: Wed Mar 14 18:37:37 2007
New Revision: 122925

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=122925
Log:
2007-03-14  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

        PR c/21438
        * c-common.h (warn_for_div_by_zero): Declare.
        * c-common.c (warn_for_div_by_zero): Define.
        * c-typeck.c (build_binary_op): Call warn_for_div_zero instead of
        warning.
cp/
        * typeck.c (build_binary_op): Call warn_for_div_zero instead of
        warning.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-common.c
    trunk/gcc/c-common.h
    trunk/gcc/c-typeck.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck.c


-- 


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


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

* [Bug c/21438] Warning about division by zero depends on lexical form
       [not found] <bug-21438-6@http.gcc.gnu.org/bugzilla/>
  2007-01-16  0:57 ` patchapp at dberlin dot org
@ 2007-03-12  1:32 ` patchapp at dberlin dot org
  2007-03-14 18:38 ` manu at gcc dot gnu dot org
  2007-03-14 18:39 ` manu at gcc dot gnu dot org
  3 siblings, 0 replies; 7+ messages in thread
From: patchapp at dberlin dot org @ 2007-03-12  1:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from patchapp at dberlin dot org  2007-03-12 01:32 -------
Subject: Bug number PR 21438

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-03/msg00700.html


-- 


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


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

* [Bug c/21438] Warning about division by zero depends on lexical form
       [not found] <bug-21438-6@http.gcc.gnu.org/bugzilla/>
@ 2007-01-16  0:57 ` patchapp at dberlin dot org
  2007-03-12  1:32 ` patchapp at dberlin dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: patchapp at dberlin dot org @ 2007-01-16  0:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from patchapp at dberlin dot org  2007-01-16 00:57 -------
Subject: Bug number PR 21438

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-01/msg01166.html


-- 


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


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

* [Bug c/21438] Warning about division by zero depends on lexical form
  2005-05-07  8:09 [Bug c/21438] New: " neil at gcc dot gnu dot org
  2005-05-07 18:18 ` [Bug c/21438] " pinskia at gcc dot gnu dot org
@ 2005-05-07 18:20 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-07 18:20 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-07 18:20 -------
Hmm, I wonder why C++ warns though:
t.c:2: warning: division by zero in '1.0e+0f / 0.'
t.c:3: warning: division by zero in '1.0e+0f / 0'

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |3.2.3 3.3.4 3.4.2 4.0.0
                   |                            |4.1.0


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


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

* [Bug c/21438] Warning about division by zero depends on lexical form
  2005-05-07  8:09 [Bug c/21438] New: " neil at gcc dot gnu dot org
@ 2005-05-07 18:18 ` pinskia at gcc dot gnu dot org
  2005-05-07 18:20 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-07 18:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-05-07 18:18 -------
Confirmed, it is obvious from looking at the code what was wrong.  The following patch should fix it 
but I don't have time to test it fully:
Index: c-typeck.c
===============================================================
====
RCS file: /cvs/gcc/gcc/gcc/c-typeck.c,v
retrieving revision 1.439
diff -u -p -r1.439 c-typeck.c
--- c-typeck.c	2 May 2005 16:02:19 -0000	1.439
+++ c-typeck.c	7 May 2005 18:17:53 -0000
@@ -7462,7 +7462,8 @@ build_binary_op (enum tree_code code, tr
     case EXACT_DIV_EXPR:
       /* Floating point division by zero is a legitimate way to obtain
 	 infinities and NaNs.  */
-      if (warn_div_by_zero && skip_evaluation == 0 && integer_zerop (op1))
+      if (warn_div_by_zero && skip_evaluation == 0
+          && integer_zerop (op1) && code0 != REAL_TYPE)
 	warning (0, "division by zero");
 
       if ((code0 == INTEGER_TYPE || code0 == REAL_TYPE



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2005-05-07 18:18:42
               date|                            |


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


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

end of thread, other threads:[~2021-09-28  8:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-21438-4@http.gcc.gnu.org/bugzilla/>
2021-09-28  8:25 ` [Bug c/21438] Warning about division by zero depends on lexical form pinskia at gcc dot gnu.org
     [not found] <bug-21438-6@http.gcc.gnu.org/bugzilla/>
2007-01-16  0:57 ` patchapp at dberlin dot org
2007-03-12  1:32 ` patchapp at dberlin dot org
2007-03-14 18:38 ` manu at gcc dot gnu dot org
2007-03-14 18:39 ` manu at gcc dot gnu dot org
2005-05-07  8:09 [Bug c/21438] New: " neil at gcc dot gnu dot org
2005-05-07 18:18 ` [Bug c/21438] " pinskia at gcc dot gnu dot org
2005-05-07 18:20 ` pinskia 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).