From 1c8f47484870cd60f2a95d34c960023af6cf7071 Mon Sep 17 00:00:00 2001
From: Mathias Vorreiter Pedersen <mathiasvp@github.com>
Date: Tue, 7 Nov 2023 15:16:38 +0000
Subject: [PATCH] C++: Add comment as suggested in the PR review for #14708.

---
 cpp/ql/test/library-tests/ir/range-analysis/test.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/cpp/ql/test/library-tests/ir/range-analysis/test.cpp b/cpp/ql/test/library-tests/ir/range-analysis/test.cpp
index 1753431a6dfa..7234449a4ed2 100644
--- a/cpp/ql/test/library-tests/ir/range-analysis/test.cpp
+++ b/cpp/ql/test/library-tests/ir/range-analysis/test.cpp
@@ -134,6 +134,12 @@ void test_div(int x) {
 struct X { int n; };
 void read_argument(const X *);
 
+// This test exists purely to ensure that modulus analysis terminates in the
+// presence of inexact phi operands. The LoadInstruction on `while(x->n) { ... }`
+// reads from a PhiInstruction with two input operands: an exact operand defined
+// by the StoreInstruction generated by `x->n--` and an inexact operand coming
+// from the WriteSideEffect generated by `read_argument(x)`. If we don't consider
+// the inexact operand modulus analysis fails to terminate.
 void nonterminating_without_operands_as_ssa(X *x) {
   read_argument(x);
   while (x->n) {