From 0bf64256ecf10af974c1970d87ffad19cbce7b51 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Sat, 26 Aug 2017 22:54:59 +0200
Subject: [PATCH] Add missing assert.

---
 ChangeLog     | 5 +++++
 ecc-mod-inv.c | 1 +
 2 files changed, 6 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index de6fc6dc..3a027a61 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-08-26  Niels Möller  <nisse@lysator.liu.se>
+
+	* ecc-mod-inv.c (ecc_mod_inv): Add missing assert. Fixes a
+	"dead increment" warning from the clang static analyzer.
+
 2017-07-18  Niels Möller  <nisse@lysator.liu.se>
 
 	* ecc-add-eh.c (ecc_add_eh): Fix in-place operation by reordering
diff --git a/ecc-mod-inv.c b/ecc-mod-inv.c
index f65c9da4..8cfd2e3b 100644
--- a/ecc-mod-inv.c
+++ b/ecc-mod-inv.c
@@ -145,6 +145,7 @@ ecc_mod_inv (const struct ecc_modulo *m,
       cnd_swap (swap, up, vp, n);
       cy = cnd_sub_n (odd, up, vp, n);
       cy -= cnd_add_n (cy, up, m->m, n);
+      assert (cy == 0);
 
       cy = mpn_rshift (ap, ap, n, 1);
       assert (cy == 0);
-- 
GitLab