[clang-tools-extra] [clang-tidy] Fix altera-unroll-loops crash on multi-decl for init (PR #203865)

Zeyi Xu via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 15 02:54:05 PDT 2026


================
@@ -125,13 +125,49 @@ void for_loops(int *A, int size) {
     A[i]++;
   }
 
+#pragma unroll
+  for (int i = 0, j = 0; i < 50; ++i) {
+    A[i] += j;
+  }
+
+#pragma unroll
+  for (int i = 0, j = 0; i < 50; ++i, ++j) {
+    // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: loop likely has a large number of iterations and thus cannot be fully unrolled; to partially unroll this loop, use the '#pragma unroll <num>' directive
+    // FIXME: This is a false positive.
----------------
zeyi2 wrote:

The `// FIXME`s in this file are all existing behaviors:

https://godbolt.org/z/14eG9jKWW

So there are no actual visible regressions, and IMHO fixing these FPs/FNs should be in another PR.

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


More information about the cfe-commits mailing list