AI review of 2026-11-20_12-57-55-d241c95bb4ae-results.txt PR: #9033 https://github.com/cppcheck-opensource/cppcheck/pull/9033 Tested: d241c95bb4ae0077096fa8febf1714ea8fbb94fd Merge base: 415be9ca7e74488abc8788169d8ec7f2a8ce11da Reviewed: 2026-11-21 00:54:52 UTC Model: claude-opus-5-5 (effort high) Results: 50 reviewed of 50 in the report Verdicts: 34 acceptable regression, 14 improvement, 2 unclear Tokens: 81202 input, 98064 cache read, 4086 cache write, 39964 output The verdicts are written by AI and can be wrong. ---- 1 / 50 ---- Verdict: ACCEPTABLE REGRESSION (medium confidence) Package: https://ftp.debian.org/debian/pool/main/b/bacula/bacula_15.0.3.orig.tar.gz Result: main bacula-15.0.3/src/lib/bregex.c:748:19: style: Variable 'p2' can be declared as pointer to const [constVariablePointer] Explanation: In the visible code, 'p2' is assigned from 'code' and used only in the pointer difference '(int)(p2 - bufp->buffer)'. As far as I recall the rest of the function, nothing writes through 'p2', so it really could be 'const unsigned char *'. The old warning was therefore a true positive. The PR replaced the blanket skip for '-' with a check that requires the '-' result to have a known non-pointer valueType. Here the valueType is apparently missing (the result is wrapped in an int cast), so the variable is now treated as non-const and the warning is lost. That is a new false negative, not a false positive being fixed. ---- 2 / 50 ---- Verdict: IMPROVEMENT (medium confidence) Package: https://ftp.debian.org/debian/pool/main/b/bacula/bacula_15.0.3.orig.tar.gz Result: main bacula-15.0.3/src/lib/lz4.c:1130:17: style: Variable 'oend' can be declared as pointer to const [constVariablePointer] Explanation: In LZ4_decompress_generic, 'oend' is the end of the writable output buffer. Upstream LZ4 code of this version later does 'BYTE* const oCopyLimit = oend-(WILDCOPYLENGTH-1);' and passes oCopyLimit to LZ4_wildCopy, whose dstEnd parameter is a non-const void*. That later code is not in the excerpt shown; this relies on knowing the LZ4 source. Making oend a pointer to const would break that assignment. Before the PR, '-' on a pointer was always skipped, so this use was ignored and the warning was a false positive. The PR now follows 'oend - x' to the assignment target and sees the non-const use, so removing the warning is correct. ---- 3 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/b/bacula/bacula_15.0.3.orig.tar.gz Result: main bacula-15.0.3/src/lib/lz4.c:759:17: style: Variable 'oMaxLit' can be declared as pointer to const [constVariablePointer] Explanation: oMaxLit is used in `BYTE* const oMaxSeq = oMaxLit - 1;`, which assigns it to a non-const `BYTE*`. If oMaxLit were declared `const BYTE*`, that initialization would not compile. Main skipped every binary '-' parent, so it missed this use and reported a false positive. The PR only skips '-' when the result is not a pointer, so it now sees the pointer result flowing into a non-const pointer and correctly drops the warning. ---- 4 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/b/bsd-mailx/bsd-mailx_8.1.2-0.20220412cvs.orig.tar.xz Result: main bsd-mailx-8.1.2-0.20220412cvs.orig/head.c:247:16: style: Parameter 'wp' can be declared as pointer to const [constParameterPointer] Explanation: nextword() returns `wp - 1` as a `char *`. If `wp` were declared `const char *`, that return would discard the const qualifier and need a cast, so the constParameterPointer suggestion was a false positive. The PR stops ignoring the pointer subtraction `wp - 1` when its result is still a pointer, which is exactly the #15219 case in the new test. Removing this warning is correct. ---- 5 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/d/dietlibc/dietlibc_0.34~cvs20160606+ds.orig.tar.xz Result: main dietlibc-0.34~cvs20160606+ds/lib/stpncpy.c:6:9: style: Variable 'x' can be declared as pointer to const [constVariablePointer] Explanation: `x` is returned as `x-1` from a function returning `char*`. If `x` were declared `const char*`, `x-1` would also be `const char*` and could not be returned as `char*` without a cast. The old warning was therefore a false positive. The PR now treats pointer subtraction that yields a pointer like `+`, so it follows the result to the `return`. That removes the false warning. ---- 6 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/gfarm/gfarm_2.8.11+dfsg.orig.tar.xz Result: main gfarm-2.8.11/gftool/gfmdhost/gfmdhost.c:279:28: style: Variable 's' can be declared as pointer to const [constVariablePointer] Explanation: `s` is used in `p = s - 1`, where `p` is a non-const `unsigned char *`. Declaring `s` as pointer to const would make that assignment discard the const qualifier unless `p` were changed too. Main skipped every binary `-` parent, so it missed that the pointer escapes into a non-const pointer and reported `s`. The PR now treats pointer-valued `s - 1` like `s + 1`, the same pattern as its `int* q = s - 1;` test case. Removing this false positive is an improvement. ---- 7 / 50 ---- Verdict: IMPROVEMENT (medium confidence) Package: https://ftp.debian.org/debian/pool/main/g/gfarm/gfarm_2.8.11+dfsg.orig.tar.xz Result: main gfarm-2.8.11/gftool/gfmdhost/gfmdhost.c:304:28: style: Variable 's' can be declared as pointer to const [constVariablePointer] Explanation: In the loop, `s` is dereferenced with `*s++`, and its value is also assigned to a non-const pointer with `p = s - 1`. Making only `s` a pointer to const would break that assignment: it is a qualifier-discarding conversion in C and an error in C++. Main treated binary `-` as a harmless use, so it reported `s`. The PR now follows a pointer-typed `s - 1` like `s + 1`, matching the new test (`int* q = s - 1; return q;` gives no warning). Removing this warning makes Cppcheck consistent with its usual rule of not suggesting const when the pointer flows into a non-const pointer. One could argue `p` and `s` could both be made const together, which is why confidence is medium. ---- 8 / 50 ---- Verdict: UNCLEAR (low confidence) Package: https://ftp.debian.org/debian/pool/main/g/gfarm/gfarm_2.8.11+dfsg.orig.tar.xz Result: main gfarm-2.8.11/linux/kernel/gfsk_netdb.c:184:13: style: Variable 'ep' can be declared as pointer to const [constVariablePointer] Explanation: `ep` is an end-of-buffer pointer (`(char *)ent + PAGE_SIZE`). In the shown code it is only read, in `bp + len >= ep`, so the original constVariablePointer warning looks valid there. The warning disappeared because of some use of `ep` with binary `-` after line 224, which is not shown. If that use is a write through the result, such as `*(ep - 1) = 0`, or passes `ep - n` to a function that takes a non-const pointer, the old warning was a false positive and its removal is an improvement. If it is just a pointer difference such as `ep - bp` whose type Cppcheck could not determine, the removal is a lost true positive. The source does not show which case applies. ---- 9 / 50 ---- Verdict: ACCEPTABLE REGRESSION (medium confidence) Package: https://ftp.debian.org/debian/pool/main/g/glibc/glibc_2.44.orig.tar.xz Result: main glibc-2.44/nptl/allocatestack.c:646:9: style: Variable 'stacktop' can be declared as pointer to const [constVariablePointer] Explanation: `stacktop` is a `void *` that is only assigned and then used in the pointer difference `stacktop - pd->stackblock`. Nothing is ever written through it, so `const void *` would work and the old warning was a true positive. The PR stops skipping a `-` parent unless that parent has a non-pointer value type. For `void*` minus `void*` (a GNU extension), Cppcheck probably cannot determine the value type, so the new skip does not apply. The variable is then also treated as used in non-const pointer arithmetic, so the warning is lost. That is a new false negative, not a new false positive. ---- 10 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/glibc/glibc_2.44.orig.tar.xz Result: main glibc-2.44/sysdeps/unix/sysv/linux/tst-socket-timestamp.c:58:63: style: Parameter 'cmsg' can be declared as pointer to const [constParameterPointer] Explanation: In this code, `char *msg_control = cmsg - msg_controllen;` is followed by `memset(msg_control, ...)`, and the buffer is also handed to recvmsg through mmhdr. The pointer arithmetic result is written through, so 'cmsg' cannot be made pointer to const. The old warning was a false positive caused by the blanket `-` skip. The PR now treats pointer subtraction like `+`, which removes it. ---- 11 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/g/glibc/glibc_2.44.orig.tar.xz Result: your glibc-2.44/malloc/mcheck-impl.c:408:33: style: Parameter 'h' can be declared as pointer to const [constParameterPointer] Explanation: mcheck_usable_size only reads (h - 1)->size and never writes through h, so 'struct hdr *h' could be 'const struct hdr *h'. Before the PR, cppcheck skipped any pointer used in '-' arithmetic. Now it follows the derefence through 'h - 1' and correctly reports a true positive. ---- 12 / 50 ---- Verdict: IMPROVEMENT (medium confidence) Package: https://ftp.debian.org/debian/pool/main/g/gnss-sdr/gnss-sdr_0.0.22.orig.tar.gz Result: main gnss-sdr-0.0.22/src/core/libs/supl/types/INTEGER.c:1035:14: style: Variable 'end' can be declared as pointer to const [constVariablePointer] Explanation: `end` is used in `uint8_t *end1 = end - 1;`, which initializes a non-const `uint8_t*` from `end - 1`. If `end` were declared `const uint8_t *`, that initialization would discard the qualifier (an error in C++, a diagnostic in C), so the suggestion is wrong as stated. Main skipped every binary `-` parent, which caused this false positive. The PR now follows pointer-valued `-` like `+`, sees the assignment to a non-const pointer, and drops the warning. ---- 13 / 50 ---- Verdict: ACCEPTABLE REGRESSION (medium confidence) Package: https://ftp.debian.org/debian/pool/main/g/gnss-sdr/gnss-sdr_0.0.22.orig.tar.gz Result: main gnss-sdr-0.0.22/src/core/libs/supl/types/INTEGER.c:123:14: style: Variable 'buf_end' can be declared as pointer to const [constVariablePointer] Explanation: `buf_end` is only used for comparisons and pointer differences (`buf < buf_end - 1`, `buf_end - buf`, `buf == buf_end`), and nothing is written through it, so `const uint8_t *buf_end` would be valid. The warning was a true positive. With the PR, `buf_end - 1` has pointer type, so the new `-` handling no longer skips it. In addition, `hasIncDecPlusMinus` is set to true even though the parent is `<` and not a dereference. As a result the variable is treated as non-const and the warning is lost. This is a new false negative. ---- 14 / 50 ---- Verdict: ACCEPTABLE REGRESSION (medium confidence) Package: https://ftp.debian.org/debian/pool/main/g/gnss-sdr/gnss-sdr_0.0.22.orig.tar.gz Result: main gnss-sdr-0.0.22/src/core/libs/supl/types/NativeEnumerated.c:207:29: style: Variable 'kf' can be declared as pointer to const [constVariablePointer] Explanation: In asn1c's NativeEnumerated_encode_uper, 'kf' is set from bsearch, checked with '!kf', and then used only in a pointer difference ('value = kf - specs->value2enum'). Nothing is written through it, so 'pointer to const' was a true positive. The PR stopped skipping every '-' parent and now skips it only when the result's valueType is known and is not a pointer. Here the valueType of the pointer subtraction is apparently unknown, so the check falls through and treats 'kf' as non-const. The warning is lost, a new false negative. The lines after 247 are not shown, but this matches the standard asn1c code. ---- 15 / 50 ---- Verdict: ACCEPTABLE REGRESSION (medium confidence) Package: https://ftp.debian.org/debian/pool/main/g/gsequencer/gsequencer_9.3.4.orig.tar.gz Result: main gsequencer-9.3.4/ags/audio/file/ags_sndfile.c:1793:11: style: Variable 'retval' can be declared as pointer to const [constVariablePointer] Explanation: In ags_sndfile_vio_read, 'retval' is assigned once from the memcpy result and then only used in the pointer difference 'retval - sndfile->pointer'. Nothing is written through it, so 'const guchar *retval' would compile fine (C allows subtracting pointers to differently qualified compatible types). The removed warning was therefore a true positive. The PR changed how '-' is handled: it no longer skips '-' unconditionally, but only when the result's valueType is known to be a non-pointer. Here the subtraction is wrapped in a cast, and the valueType of 'sndfile->pointer' is probably unknown. As a result the variable is now treated as possibly non-const. This is a new false negative, not a new false positive. ---- 16 / 50 ---- Verdict: ACCEPTABLE REGRESSION (medium confidence) Package: https://ftp.debian.org/debian/pool/main/g/gsequencer/gsequencer_9.3.4.orig.tar.gz Result: main gsequencer-9.3.4/ags/audio/file/ags_sndfile.c:1820:11: style: Variable 'retval' can be declared as pointer to const [constVariablePointer] Explanation: `retval` is assigned the result of `memcpy`. After that it is only used in the pointer difference `retval - sndfile->pointer`, which yields an integer. It is never written through, so declaring it `const guchar *` would be valid, and main's warning was a true positive. The PR now ignores a `-` parent only when its value type is known to be a non-pointer. Here the type of the subtraction is probably unknown (for example, `sndfile->pointer` may not be resolved), so the usage is treated as non-const and the warning is lost. This is a new false negative, not a removed false positive. ---- 17 / 50 ---- Verdict: ACCEPTABLE REGRESSION (low confidence) Package: https://ftp.debian.org/debian/pool/main/g/gsequencer/gsequencer_9.3.4.orig.tar.gz Result: main gsequencer-9.3.4/ags/audio/midi/ags_midi_file.c:1144:25: style: Variable 'start' can be declared as pointer to const [constVariablePointer] Explanation: `start` is set to `midi_file->iter - 4` and appears to be used only for reading, such as pointer differences or copying. Main suggested making it pointer-to-const, which looks correct. The PR no longer skips every `-` parent; it now skips only when the result's valueType is known to be a non-pointer. A use like `midi_file->iter - start` without a known valueType (e.g. if the struct type is unresolved) would therefore count as non-const usage, and the warning disappears. That is probably a lost true positive. The later uses of `start` are not shown, so this cannot be fully verified. ---- 18 / 50 ---- Verdict: ACCEPTABLE REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/h/h2o/h2o_2.2.5+dfsg2.orig.tar.xz Result: main h2o-2.2.5+dfsg2/deps/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c:429:51: style: Parameter 'pc' can be declared as pointer to const [constParameterPointer] Explanation: `check_start_pc_for_line` only reads `pc`: it compares it with `irep->iseq` and computes the difference `pc - irep->iseq - 1`. It never writes through `pc`, so `mrb_code *pc` could be `const mrb_code *pc` and the main warning was a true positive. The PR removed `-` from the unconditional skip list. It now skips only when the `-` expression's valueType is known to be non-pointer. Here `irep->iseq` likely has no known type, so the skip no longer applies. The PR also sets `hasIncDecPlusMinus` even when no dereference follows, which may also have affected this case. The result is a lost true positive (a new false negative). ---- 19 / 50 ---- Verdict: ACCEPTABLE REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/h/h2o/h2o_2.2.5+dfsg2.orig.tar.xz Result: main h2o-2.2.5+dfsg2/deps/mruby/mrbgems/mruby-sprintf/src/sprintf.c:766:19: style: Variable 'p' can be declared as pointer to const [constVariablePointer] Explanation: The local `char *p` is only read once, in the pointer difference `p - RSTRING_PTR(str)`. Nothing is written through it, so it could be `const char *` and the old warning was a true positive. The PR removed `-` from the unconditional skip list and now skips only when the `-` result has a non-pointer valueType. Here the operand comes from the `RSTRING_PTR` macro, so the valueType of the subtraction is probably unknown. The PR also now walks through `p - x` as a dereference candidate. Either way the usage is no longer recognised as harmless and the true positive is lost, giving a new false negative. ---- 20 / 50 ---- Verdict: ACCEPTABLE REGRESSION (medium confidence) Package: https://ftp.debian.org/debian/pool/main/h/h2o/h2o_2.2.5+dfsg2.orig.tar.xz Result: main h2o-2.2.5+dfsg2/deps/mruby/src/backtrace.c:40:15: style: Variable 'pc' can be declared as pointer to const [constVariablePointer] Explanation: `pc` is only assigned from other pointers and used in `pc - irep->iseq`, a pointer difference passed as an offset. It is never written through, so `const mrb_code *pc` would be valid and the removed warning was a true positive. The PR now skips `-` only when the result type is known to be a non-pointer. Here the type of `pc - irep->iseq` is most likely unknown (the mruby header types may not be resolved), so the check bails out and the warning is lost. This is a new false negative, not a removed false positive. ---- 21 / 50 ---- Verdict: IMPROVEMENT (medium confidence) Package: https://ftp.debian.org/debian/pool/main/h/h2o/h2o_2.2.5+dfsg2.orig.tar.xz Result: main h2o-2.2.5+dfsg2/deps/mruby/src/error.c:201:13: style: Variable 'pc' can be declared as pointer to const [constVariablePointer] Explanation: `pc` is used in `err = pc - 1;`, and `err` is declared as non-const `mrb_code *`. If only `pc` were made const, this assignment would discard the const qualifier (a C diagnostic). Before the PR, cppcheck ignored `-` entirely. Now it treats `pc - 1` as pointer arithmetic and sees the result assigned to a non-const pointer, so the per-variable suggestion is no longer made. Making both `pc` and `err` const together would compile, but taken alone the old warning was misleading. Removing it fits cppcheck's per-variable logic. ---- 22 / 50 ---- Verdict: ACCEPTABLE REGRESSION (medium confidence) Package: https://ftp.debian.org/debian/pool/main/h/h2o/h2o_2.2.5+dfsg2.orig.tar.xz Result: main h2o-2.2.5+dfsg2/deps/mruby/src/error.c:204:15: style: Variable 'err' can be declared as pointer to const [constVariablePointer] Explanation: `err` is never written through. It is assigned from `ci->err` or `pc - 1`, tested for null, and used in the pointer difference `err - irep->iseq`. Declaring it `const mrb_code *` would compile fine, so the removed warning was a true positive. The PR changed how a binary `-` parent is handled, so the pointer subtraction no longer counts as a read-only use. That loses this valid warning, a new false negative. ---- 23 / 50 ---- Verdict: ACCEPTABLE REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/h/h2o/h2o_2.2.5+dfsg2.orig.tar.xz Result: main h2o-2.2.5+dfsg2/deps/mruby/src/string.c:535:9: style: Variable 's' can be declared as pointer to const [constVariablePointer] Explanation: In str_rindex, 's' is never written through. It is only compared (sbeg <= s), passed to memcmp (const void*), decremented (s--), and used in the pointer difference s - RSTR_PTR(ps). So 'const char *s' would be valid and the old warning was a true positive. The PR stops skipping '-' unconditionally and only skips it when the result's valueType is known to be a non-pointer. Here RSTR_PTR is a macro, so the difference's valueType is likely unknown, and the variable is now conservatively treated as non-const. A true positive was lost (new false negative). ---- 24 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/h/h2o/h2o_2.2.5+dfsg2.orig.tar.xz Result: main h2o-2.2.5+dfsg2/lib/handler/fastcgi.c:248:19: style: Variable 'dst_end' can be declared as pointer to const [constVariablePointer] Explanation: dst_end is used as `dst_end - path_info.len` and passed as the destination of memcpy, which writes through it. It cannot be const char*. Main wrongly skipped any '-' parent and so reported a false positive. The PR now only skips '-' when the result is not a pointer, which removes this false positive. ---- 25 / 50 ---- Verdict: ACCEPTABLE REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/i/inkscape/inkscape_1.4.3.orig.tar.xz Result: main inkscape-1.4.3_2025-12-25_0d15f75042/src/3rdparty/autotrace/filename.c:42:10: style: Variable 'suffix' can be declared as pointer to const [constVariablePointer] Explanation: In `remove_suffix`, `suffix` is only compared with NULL and used in pointer arithmetic (`suffix - 2 - s`). Nothing is ever written through it, so `const gchar *suffix` would compile fine, and the old warning was a true positive. The PR removed `-` from the unconditional skip list. It now only skips when the result of `-` is not a pointer. Here `suffix - 2` yields a pointer, so the use is no longer skipped and is treated as possibly non-const. The result is a new false negative. ---- 26 / 50 ---- Verdict: ACCEPTABLE REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/libf/libforms/libforms_1.2.4.orig.tar.gz Result: main xforms-1.2.4/image/postscript.c:428:11: style: Variable 'p' can be declared as pointer to const [constVariablePointer] Explanation: `p` holds the result of `strchr()` and is only used in the pointer difference `p - sp->axtic[i]` to compute an index. Nothing is ever written through `p`, so declaring it `const char *` is valid and the old warning was a true positive. The PR changed how a `-` parent is handled. The PR's skip for non-pointer `-` results evidently did not apply here, and the check now treats this pointer subtraction as a non-const use. The true positive is therefore lost, which is a new false negative. ---- 27 / 50 ---- Verdict: ACCEPTABLE REGRESSION (medium confidence) Package: https://ftp.debian.org/debian/pool/main/libf/libforms/libforms_1.2.4.orig.tar.gz Result: main xforms-1.2.4/image/postscript.c:546:11: style: Variable 'p' can be declared as pointer to const [constVariablePointer] Explanation: In add_ytics, 'p' is assigned from strchr() and only used in the pointer difference 'p - sp->aytic[i]' as an index. It is never written through, so declaring it 'const char *p' would be valid C. The warning was a true positive. The PR moved '-' out of the unconditional skip list: it is now skipped only when the result has a known non-pointer valueType. The valueType of 'p - sp->aytic[i]' is probably unknown because the struct type is not fully known, so the use is treated as a possible non-const use and the warning is lost. This is a new false negative. ---- 28 / 50 ---- Verdict: ACCEPTABLE REGRESSION (medium confidence) Package: https://ftp.debian.org/debian/pool/main/m/mailutils/mailutils_3.21.orig.tar.xz Result: main mailutils-3.21/libmailutils/address/address.c:412:13: style: Variable 'p' can be declared as pointer to const [constVariablePointer] Explanation: In mu_address_set_email, `p` comes from strchr and is only read: it is used in `p - subaddr->email`, passed as the source argument of memcpy, and in `strdup(p + 1)`. Nothing is ever written through it, so `const char *p` would work and main's constVariablePointer warning was a true positive. The PR lets `-` set hasIncDecPlusMinus even when the result is not dereferenced, and changes how a pointer subtraction is handled. That makes the check give up on `p - subaddr->email`, so the PR loses a valid warning (a new false negative). ---- 29 / 50 ---- Verdict: ACCEPTABLE REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/m/mailutils/mailutils_3.21.orig.tar.xz Result: main mailutils-3.21/libmailutils/base/version.c:181:17: style: Variable 'p' can be declared as pointer to const [constVariablePointer] Explanation: `p` holds the result of `strchr` and is used only in `if (p)` and in the pointer difference `p - mu_conf_option[i].name`. Neither use writes through it, so `const char *p` would be valid and the old warning was a true positive. The PR stops skipping `-` unconditionally. It now skips it only when the `-` result has a known non-pointer valueType. That valueType is probably unknown here (the struct is likely declared in a header Cppcheck did not see). So `p` now falls through to the non-const handling, losing a correct warning: a new false negative. ---- 30 / 50 ---- Verdict: ACCEPTABLE REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/m/mailutils/mailutils_3.21.orig.tar.xz Result: main mailutils-3.21/libmailutils/url/uplevel.c:37:9: style: Variable 'p' can be declared as pointer to const [constVariablePointer] Explanation: `p` holds the result of `strrchr(url->path, '/')`. It is only null-checked, compared with `url->path`, and used in the pointer difference `p - url->path`. Nothing is ever written through `p`, so it could be `const char *`, and the removed constVariablePointer warning was a true positive. The PR stopped treating every `-` parent as harmless. It now only skips `-` when the result has a known non-pointer valueType. Here `url->path` comes from a struct in a header Cppcheck probably did not see, so the valueType is likely missing and `p` is wrongly counted as possibly modified. The result is a new false negative, not a new false positive. ---- 31 / 50 ---- Verdict: ACCEPTABLE REGRESSION (low confidence) Package: https://ftp.debian.org/debian/pool/main/m/mailutils/mailutils_3.21.orig.tar.xz Result: main mailutils-3.21/libproto/dotmail/dotmail.c:1441:9: style: Variable 'p' can be declared as pointer to const [constVariablePointer] Explanation: The warning is for the local 'char *p' (declared a few lines below the marked line), but the code that uses 'p' is not shown. In mailutils this pattern is usually 'p = strrchr(name, '/')' followed only by reads such as a pointer difference 'p - name', so main's constVariablePointer was likely a true positive. The PR removed '-' from the unconditional 'continue' list. It now only skips '-' when the result has a known non-pointer valueType. If that valueType is missing, the read-only use falls through and is treated as non-const. The same disappearance of 'p' warnings in five files points to a systematic loss of true positives, not removed false positives. This cannot be confirmed without the usage code. ---- 32 / 50 ---- Verdict: ACCEPTABLE REGRESSION (medium confidence) Package: https://ftp.debian.org/debian/pool/main/m/mailutils/mailutils_3.21.orig.tar.xz Result: main mailutils-3.21/libproto/mbox/mboxrd.c:1632:9: style: Variable 'p' can be declared as pointer to const [constVariablePointer] Explanation: The shown excerpt does not include the uses of `p` (`char *p;` is at line 1636, and the reported line/column do not match exactly). In mailutils, `p` is typically set from `strrchr()` and then only used in a pointer difference such as `p - dmp->name` to compute a length. It is never written through, which is consistent with main reporting it. So `p` could be `const char *`, and main's constVariablePointer warning was a true positive. The PR moved `-` out of the unconditional 'continue' list. It now only skips when the result's valueType is known to be a non-pointer. For pointer-minus-pointer, the valueType is apparently missing, so the use is treated as non-const and the warning is lost. The same pattern disappears in five files. That makes this a new false negative rather than a fixed false positive. ---- 33 / 50 ---- Verdict: ACCEPTABLE REGRESSION (medium confidence) Package: https://ftp.debian.org/debian/pool/main/p/p4est/p4est_2.8.7.orig.tar.xz Result: main p4est-2.8.7/sc/src/sc_containers.c:424:23: style: Variable 'retval' can be declared as pointer to const [constVariablePointer] Explanation: 'retval' is only compared to NULL and used in the pointer difference `retval - array->array`. Neither use writes through it, so it could be declared `const char *` and the old warning was a true positive. The PR now skips '-' only when the result's valueType is known to be a non-pointer. Here the valueType of the difference is probably unknown (e.g. the sc_array_t member type is not resolved), so the use is no longer treated as safe and the warning disappears. That makes this a new false negative. ---- 34 / 50 ---- Verdict: ACCEPTABLE REGRESSION (low confidence) Package: https://ftp.debian.org/debian/pool/main/p/p4est/p4est_2.8.7.orig.tar.xz Result: main p4est-2.8.7/src/p4est_geometry.c:1034:24: style: Variable 'fcodes' can be declared as pointer to const [constVariablePointer] Explanation: `fcodes` is set to `lnodes->face_code`. In p4est, face codes are only read and decoded, so main's constVariablePointer warning looks like a true positive. The PR stops skipping every `-` parent. It now skips `-` only when the result has a known non-pointer value type, so some pointer-subtraction uses (or ones with an unknown value type) fall through and are treated as non-const uses. The same thing seems to have removed the `retval` warning in sc_containers.c, where `retval - array->array` is just a pointer difference. The usage of `fcodes` is not shown in the snippet, so this is a probable new false negative rather than a fixed false positive. ---- 35 / 50 ---- Verdict: ACCEPTABLE REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/p/putty/putty_0.85.orig.tar.gz Result: main putty-0.85/utils/log_proxy_stderr.c:55:19: style: Variable 'nlpos' can be declared as pointer to const [constVariablePointer] Explanation: `nlpos` is only used in `!nlpos` and in pointer differences (`nlpos - psb->buf`, `nlpos - psb->buf + 1`). It is never used to modify the data it points to, so `const char *nlpos` would be valid and the removed constVariablePointer warning was a true positive. The PR's new handling of binary `-` no longer always skips the subtraction. It only skips it when the result's valueType is known to be a non-pointer, which apparently fails here, perhaps because the pointer difference has no valueType in this C code. The warning is therefore lost, which is a new false negative. ---- 36 / 50 ---- Verdict: UNCLEAR (low confidence) Package: https://ftp.debian.org/debian/pool/main/q/qstat/qstat_2.18.orig.tar.gz Result: main rocketsciencegg-qstat-bb34c26/qstat.c:10805:16: style: Variable 'portptr' can be declared as pointer to const [constVariablePointer] Explanation: The PR removed the constVariablePointer warning for 'portptr', but the snippet stops before 'portptr' is used. The PR changes how a '-' parent is handled. Before, every pointer subtraction was skipped as harmless. Now only subtractions whose result is not a pointer are skipped. Subtractions that yield a pointer, e.g. 'portptr - 1', go on to the usual checks. If the code derives a non-const pointer from 'portptr' and writes through it, the old warning was a false positive and its removal is an improvement. If 'portptr' is only read (e.g. 'portptr - ipptr' passed as a length to strncpy/memcpy), the removal is a new false negative. Without the usage lines, I cannot tell which applies. ---- 37 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/q/qstat/qstat_2.18.orig.tar.gz Result: main rocketsciencegg-qstat-bb34c26/qstat.c:6850:8: style: Variable 'end' can be declared as pointer to const [constVariablePointer] Explanation: `end` is used in `char *last = end - 6;`. If `end` were declared `const char *`, then `end - 6` would also be `const char *`, and assigning it to the non-const `char *last` would not compile. So the old constVariablePointer warning was a false positive. The PR now treats pointer subtraction that yields a pointer as a non-const use, which correctly removes this warning. ---- 38 / 50 ---- Verdict: IMPROVEMENT (high confidence) Package: https://ftp.debian.org/debian/pool/main/r/ruby-oj/ruby-oj_3.17.8.orig.tar.gz Result: main ohler55-oj-58bddef/ext/oj/parse.c:1133:13: style: Variable 'end' can be declared as pointer to const [constVariablePointer] Explanation: Line 1142 does `p = end - 2;`, where `p` is a non-const `char*`. The code then writes through `p` (`*p++ = ' '` and so on). If `end` were declared `const char*`, assigning `end - 2` to `char *p` would not compile, so the constVariablePointer warning on `end` was a false positive. Main skipped every use of `end` under a binary `-` and so missed this assignment. The PR now skips `-` only when the result is not a pointer, so this pointer-result use is followed to the assignment and the false positive is gone. ---- 39 / 50 ---- Verdict: ACCEPTABLE REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/s/simgear/simgear_2024.1.5+dfsg.orig.tar.xz Result: main simgear-2024.1.5/simgear/io/iostreams/gzfstream.cxx:269:11: style: Variable 'q' can be declared as pointer to const [constVariablePointer] Explanation: In `out_waiting()`, `q` is set from `pbase()` and only used in `pptr() - q`. Pointer subtraction never writes through `q`, so `const char* q` would compile and the warning was a true positive. Before the PR, any `-` parent was skipped as a const use. Now it is only skipped when the result's valueType is known to be a non-pointer. `pptr()` is an inherited streambuf member whose type Cppcheck likely doesn't resolve, so the valueType is missing and the use is treated as possibly non-const. A correct warning is lost, which is a new false negative. ---- 40 / 50 ---- Verdict: ACCEPTABLE REGRESSION (medium confidence) Package: https://ftp.debian.org/debian/pool/main/s/simgear/simgear_2024.1.5+dfsg.orig.tar.xz Result: main simgear-2024.1.5/simgear/io/iostreams/gzfstream.cxx:285:11: style: Variable 'q' can be declared as pointer to const [constVariablePointer] Explanation: In flushbuf(), `q` is only read. It is used in the pointer difference `pptr() - q` and passed to `gzwrite`, whose buffer parameter is `voidpc` (const void*). So `char* q` could be `const char*`, and main's warning was a true positive. The PR stopped skipping binary `-` unconditionally: it now skips only when the result type is known to be non-pointer. Here `pptr()` comes from the std streambuf base, so the type of the subtraction is probably unknown, and the check gives up. The likely cause is that same lost type information, since the identical warning at line 269 also disappeared. This is a new false negative, not a removed false positive. ---- 41 / 50 ---- Verdict: ACCEPTABLE REGRESSION (medium confidence) Package: https://ftp.debian.org/debian/pool/main/v/vmatch/vmatch_2.3.1+git20240412.b3b8ac0+dfsg.orig.tar.xz Result: main vstree/src/Vmatch/apmcontain.c:166:36: style: Variable 'leftmost' can be declared as pointer to const [constVariablePointer] Explanation: 'leftmost' is only compared (== NULL, > rightmost) and used in a pointer difference `leftmost - matchtab->spaceStoreMatch`. That difference is an integer, and nothing is written through the pointer, so it could be declared `const StoreMatch *`. The original warning was a true positive. The PR stops treating `-` as an always-safe use. It now skips only when the `-` result has a non-pointer valueType, and that check apparently fails here (probably the valueType of the pointer difference is missing in this C code). So a valid warning was lost: a new false negative. ---- 42 / 50 ---- Verdict: ACCEPTABLE REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/v/vmatch/vmatch_2.3.1+git20240412.b3b8ac0+dfsg.orig.tar.xz Result: main vstree/src/Vmatch/apmcontain.c:166:47: style: Variable 'rightmost' can be declared as pointer to const [constVariablePointer] Explanation: 'rightmost' only receives a pointer and is then used in NULL and ordering comparisons and in a pointer difference ('rightmost - matchtab->spaceStoreMatch'). Nothing is ever written through it, so it could be declared 'const StoreMatch *', and the main warning was a true positive. The PR removed '-' from the unconditional skip list. It replaced it with a check that relies on the subtraction's value type being a non-pointer. That type is probably not resolved here, for example because the 'StoreMatch' definition is not visible, so the variable is now treated as possibly modified. Losing this true positive is a new false negative. ---- 43 / 50 ---- Verdict: IMPROVEMENT (medium confidence) Package: https://ftp.debian.org/debian/pool/main/v/vmatch/vmatch_2.3.1+git20240412.b3b8ac0+dfsg.orig.tar.xz Result: main vstree/src/Vmengine/edistcompl.c:180:9: style: Variable 'end' can be declared as pointer to const [constVariablePointer] Explanation: In `edistminscoreukkonencutoff`, `end` points into `pminfo->dcol`. As in the sibling function above (lines 151-154), the code most likely does `dcolptr = end-1` and then writes through `dcolptr`. `dcolptr` is a non-const `Uint*`, so `end` cannot be pointer to const. Main skipped every `-` parent, so it missed this pointer-arithmetic escape and warned falsely. The PR now only skips `-` when the result is not a pointer, which removes this false positive. Confidence is medium because the rest of this function is not shown. ---- 44 / 50 ---- Verdict: ACCEPTABLE REGRESSION (low confidence) Package: https://ftp.debian.org/debian/pool/main/v/vmatch/vmatch_2.3.1+git20240412.b3b8ac0+dfsg.orig.tar.xz Result: main vstree/src/Vmengine/edistcompl.c:88:9: style: Variable 'end' can be declared as pointer to const [constVariablePointer] Explanation: In this snippet, `end` is only assigned from `pminfo->dcol + ...` and then read: it is compared in `dcolptr < end`, and likely used in pointer differences or `*(end-1)` reads further down. No write through `end` is visible, so main's constVariablePointer warning looks like a true positive. The PR no longer skips every binary `-`. It now skips only when the result type is known to be a non-pointer, so a difference with an unknown type falls through and the variable is treated as non-const. The same pattern removed several similar warnings in this package, including `seqptr1`, which is only read and used in `seqptr1 - PMMS->sequence`. So this looks like a lost true positive rather than a removed false positive. The rest of the function is not shown, so this is uncertain. ---- 45 / 50 ---- Verdict: ACCEPTABLE REGRESSION (medium confidence) Package: https://ftp.debian.org/debian/pool/main/v/vmatch/vmatch_2.3.1+git20240412.b3b8ac0+dfsg.orig.tar.xz Result: main vstree/src/Vmengine/edistcompl.c:94:10: style: Variable 'seqptr1' can be declared as pointer to const [constVariablePointer] Explanation: In the visible code, 'seqptr1' (a Uchar*) is only read: it is dereferenced for comparison, decremented, and used in pointer differences such as 'seqptr1 - PMMS->sequence' and 'PMMS->sequence + PMMS->totallength - seqptr1'. Nothing is written through it, so it could be declared 'const Uchar *' and main's warning looks like a true positive. The PR only changes how a '-' parent is handled. Those differences go through the new '-' path and do not hit the 'continue' (probably because the type of the macro-based expression is unknown), so the variable is now treated as non-const. That loses a correct warning, a new false negative. Confidence is medium because the rest of the function is not shown. ---- 46 / 50 ---- Verdict: ACCEPTABLE REGRESSION (medium confidence) Package: https://ftp.debian.org/debian/pool/main/v/vmatch/vmatch_2.3.1+git20240412.b3b8ac0+dfsg.orig.tar.xz Result: main vstree/src/Vmengine/splitesaapm.c:48:15: style: Variable 'tptr' can be declared as pointer to const [constVariablePointer] Explanation: In the code shown, `tptr` is only read: it is initialised from `sequence + offset`, compared, decremented and dereferenced (`*tptr == ...`). Nothing writes through it, so the constVariablePointer warning in main looks correct. The PR stops treating every binary `-` as harmless; it now only skips it when the result is known to be a non-pointer. A pointer difference like `tptr - sequence` further down the function, where the value type may be unknown because typedefs are unresolved, would therefore now suppress the warning. All ten removals in this package follow the same pattern of read-only scanning pointers, so this looks like a lost true positive rather than a removed false positive. The rest of the function is not shown, which is why confidence is only medium. ---- 47 / 50 ---- Verdict: ACCEPTABLE REGRESSION (low confidence) Package: https://ftp.debian.org/debian/pool/main/v/vmatch/vmatch_2.3.1+git20240412.b3b8ac0+dfsg.orig.tar.xz Result: main vstree/src/Vmengine/splitesaapm.c:49:30: style: Variable 'end' can be declared as pointer to const [constVariablePointer] Explanation: In the visible code, `end` is only assigned (`dcol + threshold + 1`) and compared (`dcolptr < end`). Nothing writes through it, so main's constVariablePointer warning looks like a true positive. The PR stops skipping `-` unconditionally and now only skips it when the result's valueType is known to be a non-pointer. In this code `Uint` is a typedef from a header that may not be resolved, so a later `end - dcol`-style pointer difference likely has no valueType and is no longer skipped. That would suppress the warning. Similar removals across the package (`rightmost`/`leftmost`, `bestend`, `rightptr`) fit this pattern. The rest of the function is not shown, so this is a likely new false negative but uncertain. ---- 48 / 50 ---- Verdict: ACCEPTABLE REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/v/vmatch/vmatch_2.3.1+git20240412.b3b8ac0+dfsg.orig.tar.xz Result: main vstree/src/kurtz/recvirt.c:24:10: style: Variable 'tptr' can be declared as pointer to const [constVariablePointer] Explanation: In this code, 'tptr' is only read through (`*tptr == SEPARATOR`), compared, incremented, and used in a pointer difference (`tptr - virtualtree->multiseq.sequence`). Nothing is ever written through it, so it could be `const Uchar *`, and the old warning was a true positive. The PR stopped skipping every binary '-' parent and now only skips it when the result's valueType is known to be a non-pointer. Here the pointer-difference result probably lacks a valueType (it is inside a cast in C code), so the variable is no longer reported. That is a new false negative, not a removed false positive. ---- 49 / 50 ---- Verdict: ACCEPTABLE REGRESSION (high confidence) Package: https://ftp.debian.org/debian/pool/main/v/vmatch/vmatch_2.3.1+git20240412.b3b8ac0+dfsg.orig.tar.xz Result: main vstree/src/kurtz/superbck.c:21:32: style: Variable 'rightptr' can be declared as pointer to const [constVariablePointer] Explanation: `rightptr` is only read through: it is used for `->uint0` reads, pointer comparisons, and pointer differences (`rightptr - leftptr + 1`, `rightptr - largelcpvalues->spacePairUint`). It is assigned from non-const pointers, which is allowed for a pointer to const. So the original warning was a true positive. The PR drops the unconditional `-` skip. The new skip requires the `-` result to have a known non-pointer valueType, which apparently fails here, likely because the `PairUint` typedef is unresolved. As a result this true positive is no longer reported. ---- 50 / 50 ---- Verdict: ACCEPTABLE REGRESSION (medium confidence) Package: https://ftp.debian.org/debian/pool/main/v/vmatch/vmatch_2.3.1+git20240412.b3b8ac0+dfsg.orig.tar.xz Result: main vstree/src/kurtz/xdrop.c:95:30: style: Variable 'bestend' can be declared as pointer to const [constVariablePointer] Explanation: `bestend` is only initialized from `useq + ulen`, assigned from `uptr`, and (as in the sibling function above) most likely used afterwards in a pointer subtraction to compute an index. None of these uses writes through the pointer, so it could be `const Uchar *bestend`, and main's warning looks like a true positive. The PR removed `-` from the list of uses that are always const-safe. It now only skips `-` when the result has a known non-pointer valueType, which this pointer difference apparently does not satisfy, so the warning disappears. That is a new false negative rather than a fixed false positive. The code after line 135 is not shown, which keeps confidence at medium.