From: Ivan Maidanski Date: Thu, 29 Sep 2016 08:02:31 +0000 (+0300) Subject: Eliminate 'FP divide-by-zero' static analyzer warning X-Git-Tag: v7.4.6~236 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=06b4f6acccbc71fa6caa47edd12f8c1243c850b8;p=gc Eliminate 'FP divide-by-zero' static analyzer warning * tests/disclaim_bench.c (main): Print "N/A" (i.e. do not invoke printf with t/(double)free_count) if free_count <= 0. --- diff --git a/tests/disclaim_bench.c b/tests/disclaim_bench.c index 35e533bd..fc1b2ce3 100644 --- a/tests/disclaim_bench.c +++ b/tests/disclaim_bench.c @@ -134,7 +134,7 @@ int main(int argc, char **argv) t = MS_TIME_DIFF(tF, tI)*1e-3; # endif - if (model < 2) + if (model < 2 && free_count > 0) printf("%20s: %12.4lf %12lg %12lg\n", model_str[model], free_count/(double)ALLOC_CNT, t, t/free_count); else