From 43a30e1c9799fba2c926f59d488fdfbcd9f6ff54 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Wed, 28 Nov 2018 15:39:07 +0900 Subject: [PATCH] Silence clang static analyzer complaint about potential div by 0. It can't, because if b is 0 the function would have returned already; since b.m_hi is 0 b.m_lo can't be. The assert reassures clang that this is the case. --- libgnucash/engine/gnc-int128.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libgnucash/engine/gnc-int128.cpp b/libgnucash/engine/gnc-int128.cpp index d4c25bea17..e545649f72 100644 --- a/libgnucash/engine/gnc-int128.cpp +++ b/libgnucash/engine/gnc-int128.cpp @@ -770,6 +770,7 @@ GncInt128::div (const GncInt128& b, GncInt128& q, GncInt128& r) const noexcept q.m_hi = set_flags(hi, qflags); if (hi == 0 && bhi == 0) //let the hardware do it { + assert (b.m_lo != 0); // b.m_hi is 0 but b isn't or we didn't get here. q.m_lo = m_lo / b.m_lo; r.m_lo = m_lo % b.m_lo; return;