[clang] [clang][analysis][dataflow] Detect goto backedges to trigger Widen (PR #179546)

Jan Voung via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 6 07:48:34 PST 2026


================
@@ -1275,6 +1303,31 @@ TEST_F(FlowConditionTest, WhileStmtWithAssignmentInCondition) {
       });
 }
 
+TEST_F(FlowConditionTest, GotoLoopWithAssignmentInCondition) {
+  std::string Code = R"cc(
+    void target(bool Foo) {
+      // This test checks whether the analysis preserves the connection between
+      // the value of `Foo` and the assignment expression, despite widening.
+      // The equality operator generates a fresh boolean variable on each
----------------
jvoung wrote:

FWIW, this is a copy of the above `WhileStmtWithAssignmentInCondition` but with a goto instead.

I think before https://github.com/llvm/llvm-project/pull/178943, a call to a bool-valued function would have stuck with an unknown value and didn't trigger Widen.

Now that 178943 has landed, the call works. So switched to that to be less confusing. (Alternatively, could do something like `Foo = (X == 4)` but the call works now)

https://github.com/llvm/llvm-project/pull/179546


More information about the cfe-commits mailing list