From: Ilya Leoshkevich Date: Thu, 3 Dec 2020 01:01:16 +0000 (+0100) Subject: Fix division by 0 in printf_strlen_execute when dumping X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=73564433f519ba0db6f1222e829518f16028c0e2;p=gcc.git 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. --- 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);