public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/21438] Warning about division by zero depends on lexical form
Date: Sat, 07 May 2005 18:18:00 -0000	[thread overview]
Message-ID: <20050507181843.10604.qmail@sourceware.org> (raw)
In-Reply-To: <20050507080910.21438.neil@gcc.gnu.org>


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


  reply	other threads:[~2005-05-07 18:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2005-05-07 18:20 ` [Bug c/21438] " pinskia at gcc dot gnu dot 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
     [not found] <bug-21438-4@http.gcc.gnu.org/bugzilla/>
2021-09-28  8:25 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050507181843.10604.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).