AI review of 2026-11-21_23-01-25-d4960e19a063-results.txt PR: #9038 https://github.com/cppcheck-opensource/cppcheck/pull/9038 Tested: d4960e19a063aaaa01a2edbad218c02a9baf94dc Merge base: 530e59ff2e4a79db9da937ac6d8d60342c84d898 Reviewed: 2026-11-22 23:07:55 UTC Model: claude-opus-5-5 (effort high) Results: 50 reviewed of 56 in the report (random sample) Verdicts: 2 improvement, 48 regression Tokens: 84043 input, 364941 cache read, 59409 cache write, 9183 output The verdicts are written by AI and can be wrong. ---- 1 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/a/atlas/atlas_3.10.3.orig.tar.bz2 Result: your atlas-3.10.3/bin/lutst.c:124:10: warning: The loop variable 'm' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: The loop at line 124 is `for (m=M SHIFT; i < m; i++)`. `m` is just the upper bound, set in the init clause. The real loop counter is `i`, and the step clause increments it, so the loop terminates normally. The check treated `m` as the control variable only because it is assigned in the init clause and appears in the comparison. It never checks whether the step updates another variable in the condition. This is a false positive. ---- 2 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/a/atlas/atlas_3.10.3.orig.tar.bz2 Result: your atlas-3.10.3/bin/lutst.c:139:10: warning: The loop variable 'm' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: The loop is `for (m=M SHIFT; i < m; i++)`. Its real control variable is `i`, which the step clause increments. `m` is only the upper bound, initialised in the init clause, so the loop terminates normally. The checker treats the variable assigned in the init clause as the loop variable just because it also appears in the condition, without checking that `i` is the one being advanced. This is a new false positive. ---- 3 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/b/bacula/bacula_15.0.3.orig.tar.gz Result: your bacula-15.0.3/src/tools/drivetype.c:118:4: warning: The loop variable 'i' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: The loop `for (i = 0; i < argc; --argc, ++argv)` ends because its step decrements `argc`, which is part of the condition `i < argc`. The loop always terminates. The checker only looks at whether `i` is updated and ignores changes to other variables in the condition, so this warning is a false positive. ---- 4 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/b/bart/bart_1.0.00.orig.tar.gz Result: your bart-1.0.00/src/stl/misc.c:74:3: warning: The loop variable 'k' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: At line 74 the inner loop is `for (int k = 0; k < dims[1]; j++)`. Its step increments `j` instead of `k`, which is a typo bug. Nothing in the body changes `k`, and the body has no break, return or goto. Since dims[1] is 3 (asserted), the condition `k < dims[1]` stays true forever, and `j` keeps growing past its bounds. This is a real bug, so the new warning is a true positive. ---- 5 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/c/codequery/codequery_1.0.1+dfsg.orig.tar.xz Result: your codequery-1.0.1/scintilla/src/RESearch.cxx:592:5: warning: The loop variable 'sp' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: The loop is `for (sp = mp; lp < sp; lp++)`. Its init assigns `sp`, but the variable actually controlling the loop is `lp`, which the step `lp++` updates. The loop copies the bytes between `lp` and the old `mp` and always terminates. The checker took the init-assigned variable `sp` as the control variable just because it appears in the condition, and ignored that the other operand `lp` is incremented. This new warning is a false positive. ---- 6 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/c/cppcheck/cppcheck_2.22.0.orig.tar.gz Result: your cppcheck-2.22.0/addons/test/misra/misra-test.c:1336:15: warning: The loop variable 'h' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: At line 1336, `for (int h = 35; h > 5; k++) {}` initializes h to 35 and tests `h > 5`, but the step increments k, not h. The body is empty, so h is never updated and the condition stays true forever. This is an infinite loop and a true positive, even though the code is a deliberate MISRA test case. The new warning is correct. ---- 7 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/c/csound/csound_6.18.1+dfsg.orig.tar.xz Result: your csound-6.18.1/Engine/insert.c:2527:5: warning: The loop variable 'argStringCount' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: The loop is `for (argStringCount = argsRequired(...); n < argStringCount; n++)`. The real control variable is `n`, which the step clause increments. `argStringCount` is only the upper bound and is not supposed to change. The check takes the variable from the init clause and only requires it to appear in the condition. It never confirms that this variable is the one the condition depends on for termination. The loop clearly terminates, so this warning is a false positive. ---- 8 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/d/db5.3/db5.3_5.3.28+dfsg2.orig.tar.xz Result: your db-5.3.28/util/db_sql_codegen/generation_utils.c:64:4: warning: The loop variable 'tmp_i' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: The loop `for (tmp_i = out_i + indentation; out_i < tmp_i; out_i++)` uses tmp_i only as a fixed upper bound. The step `out_i++` changes the other operand of the condition, so the loop terminates normally. The checker wrongly treats the variable initialized in the init clause (tmp_i) as the control variable without checking whether another variable in the condition is updated. This is a false positive. ---- 9 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/d/db5.3/db5.3_5.3.28+dfsg2.orig.tar.xz Result: your db-5.3.28/util/db_sql_codegen/generation_utils.c:82:6: warning: The loop variable 'tmp_i' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: At line 82 the loop is `for (tmp_i = out_i + INDENT_MULTIPLIER; out_i < tmp_i; out_i++)`. `tmp_i` is the upper bound, not the control variable. `out_i` is incremented in the step clause, so the loop always terminates. The checker picks the initialized variable (`tmp_i`) as the loop variable because it appears in the condition, and then ignores that the other operand (`out_i`) is updated in the step. This is a false positive. ---- 10 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/d/db5.3/db5.3_5.3.28+dfsg2.orig.tar.xz Result: your db-5.3.28/util/db_sql_codegen/generation_utils.c:98:5: warning: The loop variable 'tmp_i' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: The loop at line 98 is `for (tmp_i = out_i + indentation; out_i < tmp_i; out_i++)`. tmp_i is only a fixed upper bound, and the real control variable is out_i, which the step clause increments. The loop ends after `indentation` iterations. The checker wrongly takes the initialized variable (tmp_i) to be the control variable and ignores that the step updates another variable in the condition. This is a new false positive. ---- 11 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/gcl27/gcl27_2.7.1.orig.tar.gz Result: your gcl-2.7.1/o/format.c:1272:4: warning: The loop variable 'm' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: At line 1272 the loop is `for (m = i + d; i < m; i++)`. The loop runs on `i`, which the step clause increments. `m` is only the upper bound set in the init clause. The check takes the init's left-hand side (`m`) as the control variable because `m` also appears in the condition, and it never considers that `i` is the variable being updated. The loop clearly terminates, so this warning is a false positive. ---- 12 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/gcl27/gcl27_2.7.1.orig.tar.gz Result: your gcl-2.7.1/o/format.c:1481:4: warning: The loop variable 'm' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: At line 1481 the loop is `for (m = i + (d - k + 1); i < m; i++)`. The init clause assigns the bound `m`, while the real loop variable is `i`, which the step clause increments. The loop terminates normally. The checker took the init's LHS `m` as the control variable because `m` appears in the condition, and then saw that `m` is never updated. This is a false positive. ---- 13 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/gnumeric/gnumeric_1.12.57.orig.tar.xz Result: your gnumeric-1.12.57/plugins/plan-perfect/pln.c:330:2: warning: The loop variable 'end' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: The loop is `for (end = ch + ui; ch < end; )`. Here `end` is only the bound that the init clause sets; the real iteration variable is `ch`. The body advances `ch` on every pass (`code = *ch++;`, `ch += len + 1;`), so `ch < end` eventually becomes false. The check wrongly picks the init-assigned bound `end` as the control variable, so this new warning is a false positive. ---- 14 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/gnumeric/gnumeric_1.12.57.orig.tar.xz Result: your gnumeric-1.12.57/src/item-bar.c:509:6: warning: The loop variable 'level' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: The loop `for (level = cri->outline_level; i++ < level; pos += inc)` is controlled by `i`, which the condition `i++ < level` increments on every check. `level` is only the upper bound. The loop always terminates once `i` exceeds `level`. The check picks `level` as the control variable only because it is the one assigned in the init clause. It never sees that the condition itself updates `i`. This is a false positive. ---- 15 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/gnumeric/gnumeric_1.12.57.orig.tar.xz Result: your gnumeric-1.12.57/src/item-bar.c:666:6: warning: The loop variable 'level' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: The loop is `for (level = cri->outline_level; i++ < level; pos += inc * dir)`. Its condition `i++ < level` increments `i` on every iteration, so the loop ends once `i` reaches `level`. `level` is a fixed bound, not the variable that advances the loop. The check picks `level` only because it is the variable assigned in the init clause. It does not notice that the other operand `i` is modified inside the condition itself. The loop always terminates, so this new warning is a false positive. ---- 16 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/i/iraf/iraf_2.18.2.orig.tar.gz Result: your iraf-community-iraf-12a9ce3/unix/f2c/libf2c/uninit.c:131:3: warning: The loop variable 'lxe' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: The loop `for(lxe = lx + 2*len; lx < lxe; lx += 2)` initializes the end pointer `lxe` and advances `lx` in the step clause. `lxe` is a fixed bound, and the real control variable `lx` is updated every iteration, so the loop terminates. The new check wrongly picks the variable assigned in the init clause as the control variable. That is a false positive. ---- 17 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/i/iraf/iraf_2.18.2.orig.tar.gz Result: your iraf-community-iraf-12a9ce3/unix/os/zxwhen.c:322:2: warning: The loop variable 'next_epa' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: The step clause `((SIGFUNC)epa)(&x_vex,&next_epa)` calls the handler and passes the address of `next_epa`. The handler writes the next handler's address through that pointer, so the loop variable is updated on every iteration. `stepUpdatesVar` only looks for inc/dec or assignment operators and misses this modification through `&next_epa`. The warning is a false positive. ---- 18 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/libl/liblsl/liblsl_1.18.0.b6+ds.orig.tar.gz Result: your liblsl-1.18.0.b6+ds/examples/TestSyncWithoutData.cpp:31:3: warning: The loop variable 'end' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: The loop `for (auto end = lsl::local_clock() + 20; lsl::local_clock() < end;)` is a timed loop. `end` is a fixed deadline and is meant to stay constant. The condition also calls `lsl::local_clock()`, which returns a different value on each call, so the loop does terminate after 20 seconds. The check only looks at whether the variable named in the condition is updated. It ignores that the other side of the comparison changes over time. `end` is also a double (`local_clock` returns double), and the check lets it through only because the type info is missing. This is a false positive. ---- 19 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/libl/liblsl/liblsl_1.18.0.b6+ds.orig.tar.gz Result: your liblsl-1.18.0.b6+ds/testing/int/sync_endian.cpp:145:3: warning: The loop variable 'end' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: The loop is `for (char *end = p + n; p < end; p += width)`. Here `end` is a fixed bound. The real control variable is `p`, which the step `p += width` advances, so the loop terminates. The check assumes the initialized variable is the control variable and ignores that the other comparison operand is updated. It also accepts `end` as a loop variable because a pointer is treated as acceptable (missing or non-integral type info is not rejected). This is a false positive. ---- 20 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/libs/libsdl1.2/libsdl1.2_1.2.15+dfsg2.orig.tar.gz Result: your SDL-1.2.15/src/video/SDL_stretch.c:294:2: warning: The loop variable 'dst_maxrow' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: The loop is `for (dst_maxrow = dst_row+dstrect->h; dst_rownDb-1; iDb<=iDbLast; iDb++)` initializes the upper bound iDbLast, but the actual loop counter is iDb, which the step `iDb++` increments. The loop terminates normally. The checker wrongly takes the variable assigned in the init clause as the control variable, even though another variable in the condition is incremented in the step. This new warning is a false positive. ---- 31 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/o/opencpn/opencpn_5.14.2+dfsg.orig.tar.xz Result: your opencpn-5.14.2/libs/sqlite/src/sqlite3.c:172819:9: warning: The loop variable 'iEnd' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: The loop `for(iEnd=sqlite3VdbeCurrentAddr(v); iOpwcs[byte_idx++] = WEOF;` is meant to stop when `byte_idx` reaches the end value stored in `remain_len`. `remain_len` is a fixed bound, and the body increments `byte_idx`, so the condition does become false and the loop terminates. The check wrongly treats the assigned variable as the loop variable, without considering that the other variable in the condition is updated. This new warning is a false positive. ---- 48 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/t/texinfo/texinfo_7.3.orig.tar.xz Result: your texinfo-7.3/gnulib/lib/regex_internal.c:336:8: warning: The loop variable 'remain_len' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: The loop at line 337 is `for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;) pstr->wcs[byte_idx++] = WEOF;`. 'remain_len' is the loop bound, not the counter. The loop advances because the body increments byte_idx, which is also in the condition, so the loop terminates. The check wrongly takes the initialized variable as the control variable without asking whether the other operand of the comparison is updated. This is a false positive. ---- 49 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/t/texinfo/texinfo_7.3.orig.tar.xz Result: your texinfo-7.3/gnulib/lib/regex_internal.c:451:6: warning: The loop variable 'remain_len' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: The loop `for (remain_len = byte_idx + mbclen - 1; byte_idx < remain_len ;) pstr->wcs[byte_idx++] = WEOF;` sets `remain_len` once as the end bound. The condition also uses `byte_idx`, which the body increments every iteration, so the loop always terminates. The check wrongly treats the bound `remain_len` as the control variable just because it is assigned in the init clause. It ignores that the other operand of the comparison is updated. This is a false positive. ---- 50 / 50 ---- Verdict: REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/v/vlc/vlc_3.0.24.orig.tar.xz Result: your vlc-3.0.24/modules/access/http/h2frame.c:752:5: warning: The loop variable 'end' is not updated in this for-loop, so the loop might never terminate. [missingForLoopIncrement] Explanation: The loop `for (const uint8_t *end = ptr + len; ptr < end; ptr += 6)` declares `end` as a fixed bound and advances `ptr` in the step clause, so the loop terminates normally. The checker wrongly picks the initialized variable `end` as the loop control variable just because it appears in the comparison. It does not recognize that the other operand, `ptr`, is the one being updated. Because `end` is a pointer, its valueType is not integral, which suggests the C type info was missing. This is a new false positive.