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

Yitzhak Mandelbaum via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 4 10:01:11 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
----------------
ymand wrote:

Why not a call to a bool-valued function? The equality operation is odd since we know its false, EXPECT_TRUE on line 1327 is surprising (if correct). If we ever upgraded to interpret `3 == 4`, it would become trivially true because the body would be dead code.

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


More information about the cfe-commits mailing list