This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/52299] GCC warns on compile time division by zero erroneously
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 20 Feb 2012 18:27:46 +0000
- Subject: [Bug c++/52299] GCC warns on compile time division by zero erroneously
- Auto-submitted: auto-generated
- References: <bug-52299-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52299
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-02-20 18:27:46 UTC ---
case COND_EXPR:
return build_x_conditional_expr
(RECUR (TREE_OPERAND (t, 0)),
RECUR (TREE_OPERAND (t, 1)),
RECUR (TREE_OPERAND (t, 2)),
complain);
For this we'd need to first RECUR (TREE_OPERAND (t, 0)), remember that result
in some temporary, and look if it is 0, non-zero or unknown. If 0, maybe
increment temporarily c_inhibit_evaluation_warnings around RECUR (TREE_OPERAND
(t, 1)) (dunno about cp_unevaluated_operand or fold_*defer_overflow_warnings
()), if non-zero similarly for RECUR (TREE_OPERAND (t, 1)).