[PATCH 6/9] div0: use -Wdiv-by-zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 expand.c    | 4 ++--
 linearize.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/expand.c b/expand.c
index 0b528ea5a..8fd258e25 100644
--- a/expand.c
+++ b/expand.c
@@ -278,7 +278,7 @@ static int simplify_int_binop(struct expression *expr, struct symbol *ctype)
 	expr->taint = left->taint | right->taint;
 	return 1;
 Div:
-	if (!conservative)
+	if (!conservative && Wdiv_by_zero)
 		warning(expr->pos, "division by zero");
 	return 0;
 Overflow:
@@ -363,7 +363,7 @@ static int simplify_float_binop(struct expression *expr)
 	expr->fvalue = res;
 	return 1;
 Div:
-	if (!conservative)
+	if (!conservative && Wdiv_by_zero)
 		warning(expr->pos, "division by zero");
 	return 0;
 }
diff --git a/linearize.c b/linearize.c
index 7760ea996..604a67b82 100644
--- a/linearize.c
+++ b/linearize.c
@@ -967,7 +967,7 @@ static void warn_undef_insn(struct instruction *insn, int warn)
 	case OP_MODU:
 	case OP_MODS:
 		if (is_pseudo_value(insn->src2, 0)) {
-			if (warn)
+			if (warn && Wdiv_by_zero)
 				warning(insn->pos, "division by zero");
 		}
 		break;
-- 
2.13.0

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux