From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10627 invoked by alias); 7 May 2005 18:18:48 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 10605 invoked by uid 48); 7 May 2005 18:18:43 -0000 Date: Sat, 07 May 2005 18:18:00 -0000 Message-ID: <20050507181843.10604.qmail@sourceware.org> From: "pinskia at gcc dot gnu dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20050507080910.21438.neil@gcc.gnu.org> References: <20050507080910.21438.neil@gcc.gnu.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c/21438] Warning about division by zero depends on lexical form X-Bugzilla-Reason: CC X-SW-Source: 2005-05/txt/msg00962.txt.bz2 List-Id: ------- 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