From 73564433f519ba0db6f1222e829518f16028c0e2 Mon Sep 17 00:00:00 2001 From: Ilya Leoshkevich Date: Thu, 3 Dec 2020 02:01:16 +0100 Subject: [PATCH] Fix division by 0 in printf_strlen_execute when dumping gcc/ChangeLog: 2020-12-03 Ilya Leoshkevich * tree-ssa-strlen.c (printf_strlen_execute): Avoid division by 0. --- gcc/tree-ssa-strlen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/tree-ssa-strlen.c b/gcc/tree-ssa-strlen.c index 741b47bca4a..522b2d45b3a 100644 --- a/gcc/tree-ssa-strlen.c +++ b/gcc/tree-ssa-strlen.c @@ -5684,7 +5684,7 @@ printf_strlen_execute (function *fun, bool warn_only) " failures: %u\n" " max_depth: %u\n", nidxs, - (nused * 100) / nidxs, + nidxs == 0 ? 0 : (nused * 100) / nidxs, walker.ptr_qry.var_cache->access_refs.length (), walker.ptr_qry.hits, walker.ptr_qry.misses, walker.ptr_qry.failures, walker.ptr_qry.max_depth);