{ "tokens": { "input": 91626, "cache_read": 95410, "cache_write": 6090, "output": 31708 }, "reviews": [ { "key": [ "https://ftp.debian.org/debian/pool/main/a/aws-crt-python/aws-crt-python_0.37.0+dfsg.orig.tar.gz", "main aws-crt-python-0.37.0/crt/aws-c-common/source/byte_buf.c:321:18: style: Variable 'first_char_location' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "`first_char_location` is only null-checked and used in the pointer difference `first_char_location - working_cur.ptr`. Neither use writes through it, so declaring it `const uint8_t *` is valid and the removed warning was a true positive. The PR is meant to skip `ptr - ptr` (a non-pointer result) without treating it as a write. The warning disappeared probably because of a side effect in the new condition: `hasIncDecPlusMinus` is now set whenever the parent is `-`, even when there is no dereference. That likely sends the variable down a path that marks it non-const, which loses a correct warning (new false negative)." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/a/aws-crt-python/aws-crt-python_0.37.0+dfsg.orig.tar.gz", "main aws-crt-python-0.37.0/crt/aws-c-common/source/hash_table.c:80:82: style: Parameter 'entry' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "In `s_index_for`, `entry` is only used in the pointer difference `entry - map->slots`, which computes an index and never modifies the pointee. Declaring the parameter as `const struct hash_table_entry *` is therefore valid, so the removed 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 is probably unknown, likely because the type of `map->slots` comes from a private header, so the usage is now treated as non-const. That creates a false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/a/aws-crt-python/aws-crt-python_0.37.0+dfsg.orig.tar.gz", "main aws-crt-python-0.37.0/crt/aws-c-common/source/ring_buffer.c:143:14: style: Variable 'tail_cpy' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "In the visible code, `tail_cpy` is only assigned from an atomic load (a `void*`). After that it is only compared (`==`, `>`, `<`) and used in pointer subtraction (`tail_cpy - head_cpy`, `tail_cpy - ring_buf->allocation`). Nothing is ever written through it, so declaring it `const uint8_t *` would be valid, and main's constVariablePointer warning looks like a true positive. The PR changed how a `-` parent is handled, and the warning disappeared. That is a new false negative rather than a fixed false positive. Confidence is medium because the end of the function is not shown." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/a/aws-crt-python/aws-crt-python_0.37.0+dfsg.orig.tar.gz", "main aws-crt-python-0.37.0/crt/aws-c-common/source/ring_buffer.c:69:14: style: Variable 'tail_cpy' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "`tail_cpy` is only filled by the atomic load macro (an assignment from a `void*`). In the shown code it is only compared and used in pointer differences such as `tail_cpy - head_cpy - 1`. Nothing is ever written through it, so `const uint8_t *tail_cpy` would be valid and the old warning was a true positive. The PR changed how a binary `-` parent is handled: a `-` is now only skipped when its result is known to be a non-pointer. Here the subtraction result's value type is probably unresolved, so the variable is no longer reported. That makes this a new false negative, not a removed false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/a/aws-crt-python/aws-crt-python_0.37.0+dfsg.orig.tar.gz", "main aws-crt-python-0.37.0/crt/aws-c-common/verification/cbmc/sources/make_common_data_structures.c:50:107: style: Parameter 'hi' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "'hi' is only compared (`lo < hi`) and used in pointer differences (`hi - lo`, `hi - buf->buffer`). It is never written through and never stored into a non-const pointer, so `const uint8_t *hi` would be valid and the main warning was a true positive. The PR removes '-' from the early-continue list and only skips it when the '-' result has a known non-pointer valueType. Here that check apparently fails, perhaps because the C pointer difference has no valueType, so 'hi' is now treated as possibly non-const. The result is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/b/bcmatroska2/bcmatroska2_5.3.101.orig.tar.gz", "main bcmatroska2-5.3.101/corec/tools/coremake/coremake.c:1280:15: style: Variable 'end' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "`end` is used in `i = end - 1`, where `i` is a non-const `char*`, and later `end = i`. Before the PR, any `-` parent was skipped, so this use was ignored and `end` was reported as const-able. Declaring only `end` as `const char*` would make `i = end - 1` drop the const qualifier, which is an error in C++ and a warning in C. The PR now handles pointer subtraction correctly and sees the result flowing into a non-const pointer, so this false positive is gone." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/clamav/clamav_1.4.6+dfsg.orig.tar.xz", "main clamav-1.4.6+dfsg/libclamav/regex/regcomp.c:1094:8: style: Variable 'top' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "In freeset(), `top` is only used in the comparison `cs == top-1`. Nothing is ever written through it, so `const cset *top` would be valid, and the main warning was a true positive. The PR stops skipping binary `-` when the result is a pointer. The `top-1` result then flows into `==`, which the code does not recognize as a read-only use, so the variable is treated as possibly modified. The warning is lost, which is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/clamav/clamav_1.4.6+dfsg.orig.tar.xz", "main clamav-1.4.6+dfsg/libfreshclam/libfreshclam.c:330:11: style: Variable 'extension' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "`extension` is assigned the result of `strstr` and is otherwise only compared with NULL and used in the pointer difference `extension - dent->d_name`. Nothing is ever written through it, so declaring it `const char *` is valid and the main warning was a true positive. The PR changed how a `-` parent is handled. When `valueType` is not available or not recognized as an integer here, `hasIncDecPlusMinus` stays set and the check falls through to treating the use as non-const. The warning is lost, which is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/cmake/cmake_4.4.5.orig.tar.gz", "main cmake-4.4.5/Utilities/cmlibuv/src/unix/pipe.c:359:9: style: Variable 'p' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "`p` is only assigned (from memchr/ARRAY_END), compared to NULL, and used in the pointer difference `p - sa.sun_path`. Nothing is ever written through it, so `const char* p` would be valid and the removed warning was a true positive. The PR changed how a `-` parent is handled. It now relies on the `-` token having a non-pointer valueType. Here that type is apparently missing (ptrdiff_t in C code), and `hasIncDecPlusMinus` is set, so the use is no longer treated as const-safe. The warning is lost, which makes this a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/cmake/cmake_4.4.5.orig.tar.gz", "main cmake-4.4.5/Utilities/cmzstd/lib/decompress/huf_decompress.c:546:71: style: Parameter 'pEnd' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "`pEnd` is only used for pointer arithmetic and comparisons: `pEnd - p`, `p < pEnd-3`, `p < pEnd`, and `pEnd-pStart`. Nothing is ever written through it, so declaring it `const BYTE* const pEnd` is valid C, and the old warning was a true positive. The PR now continues past binary `-` only when the result is not a pointer. Here `pEnd-3` yields a pointer that is then compared, which the new logic does not treat as const-safe, so the warning is lost. This is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/cmake/cmake_4.4.5.orig.tar.gz", "main cmake-4.4.5/Utilities/cmzstd/lib/decompress/zstd_decompress_block.c:908:17: style: Parameter 'oend' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`oend` is used in `BYTE* const oend_w = oend - WILDCOPY_OVERLENGTH;`, which initializes a pointer to non-const. If `oend` were declared `const BYTE*`, this initialization would discard the const qualifier and would no longer be valid as written. Main skipped every `-` parent and so missed this use, giving a false positive. The PR treats pointer subtraction like `+`, follows the result into the non-const pointer, and correctly drops the warning." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/cmake/cmake_4.4.5.orig.tar.gz", "main cmake-4.4.5/Utilities/cmzstd/lib/dictBuilder/divsufsort.c:1075:31: style: Parameter 'middle' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`middle` is only used in `b = middle - 1`, where `b` is a non-const `int*` that is later written through via `SWAP(*b, *a)`. Declaring `middle` as `const int*` would make that assignment drop const, so the old warning was a false positive. The PR stops treating pointer subtraction `-` as a non-modifying use and no longer reports it." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/cmake/cmake_4.4.5.orig.tar.gz", "main cmake-4.4.5/Utilities/cmzstd/lib/dictBuilder/divsufsort.c:1117:26: style: Parameter 'a' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "In tr_copy, 'a' is used as `d = a - 1;` where `d` is a non-const `int*`, and `d` is later written through (`*++d = s`). Declaring 'a' as `const int*` would make that assignment drop const, so the old constParameterPointer warning was a false positive. The PR now treats `-` with a pointer result like `+`, so it follows the result into the assignment and no longer reports it." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/cmake/cmake_4.4.5.orig.tar.gz", "main cmake-4.4.5/Utilities/cmzstd/lib/dictBuilder/divsufsort.c:1117:42: style: Parameter 'last' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "In tr_copy, `last` is only used in `c = last - 1`, where `c` is a non-const `int*`. If `last` were declared `const int*`, that assignment would discard the const qualifier and the code would not compile cleanly. Main skipped any `-` parent entirely, so it missed this. The PR treats a pointer-valued `p - 1` like `p + 1` and follows it to the assignment into a non-const pointer, which suppresses the warning. This matches Cppcheck's usual rule of not warning when a pointer flows into a non-const pointer. The removed warning was a false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/cmake/cmake_4.4.5.orig.tar.gz", "main cmake-4.4.5/Utilities/cmzstd/lib/dictBuilder/divsufsort.c:1145:33: style: Parameter 'a' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "In tr_partialcopy, `d = a - 1` copies a pointer derived from `a` into the non-const `int *d`, and the code then writes through it with `*++d = s`. So `a` cannot be declared `const int*`: the assignment to `int *d` would fail in C++ or drop the qualifier in C, and the memory is actually modified. The old warning was a false positive caused by `-` being treated as a non-modifying use. The PR now follows the pointer arithmetic and drops the warning, which is correct." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/cmake/cmake_4.4.5.orig.tar.gz", "main cmake-4.4.5/Utilities/cmzstd/lib/dictBuilder/divsufsort.c:1145:49: style: Parameter 'last' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`last` is used only in `c = last - 1`, where `c` is a non-const `int*`. Making `last` a `const int*` would mean assigning a const pointer to a non-const pointer, so the code would not compile cleanly without other changes. Main ignored every binary `-` and so missed this pointer escape. The PR now follows pointer arithmetic with `-` into the assignment, which removes this false positive. This is the same pattern as the PR's new test case (#15219)." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/cmake/cmake_4.4.5.orig.tar.gz", "main cmake-4.4.5/Utilities/cmzstd/lib/dictBuilder/divsufsort.c:262:35: style: Parameter 'last' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`last` is used in `i = last - 2`, which assigns to the non-const `int *i`. Writes then go through `i` and through `j = i + 1`, for example `*(j - 1) = *j` and `*j = ~*j`. If `last` were `const int*`, assigning it to a non-const pointer would discard the qualifier. So `last` cannot be made pointer to const, and the old warning was a false positive. Before the PR, a pointer subtraction result was treated as not using the pointer, so the warning appeared. The PR now only skips `-` when the result is not a pointer, which removes this false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/cmake/cmake_4.4.5.orig.tar.gz", "main cmake-4.4.5/Utilities/cmzstd/lib/dictBuilder/divsufsort.c:690:48: style: Parameter 'last' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "In ss_mergebackward, `last` is used in `a = last - 1`, and the code then writes through `a` (`*a-- = *b`, `*a = *b`). So `last` cannot be a pointer to const, and main's constParameterPointer warning was a false positive. Before the PR, the check skipped any parent `-` without analysing it, so it never saw that `last - 1` flows into a non-const pointer. The PR now treats pointer subtraction like `+` and follows the result, so the false positive is gone." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/cmake/cmake_4.4.5.orig.tar.gz", "main cmake-4.4.5/Utilities/cmzstd/lib/dictBuilder/divsufsort.c:932:8: style: Variable 'a' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "In tr_insertionsort, `b = a - 1` is assigned to `int *b`, and `b` is then written through (`*(b + 1) = *b`, `*b = ~*b`). If `a` were declared `const int *`, this assignment would drop the const qualifier, so `a` cannot be pointer to const. Main missed the use through `a - 1` because it skipped every `-` parent. The PR now follows pointer subtraction and removes this false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/d/dextractor/dextractor_1.0.orig.tar.gz", "main DEXTRACTOR-1.0/dextract.c:274:18: style: Variable 'rlen' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "unclear", "confidence": "low", "explanation": "The PR makes `ptr - n` count as producing a pointer that may be used to modify data, so `-` no longer automatically skips the check. That must be why the constVariablePointer warning for `rlen` disappeared. The excerpt only shows the declaration of `rlen`, not its uses. So we cannot tell whether `rlen - \u2026` flows into a non-const pointer such as `hlen` that is written through, which would make the old warning a false positive. If instead the result is only read, the removal is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/d/di/di_6.2.2.2.orig.tar.gz", "main di-6.2.2.2/distrutils.c:86:10: style: Variable 'p' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`p` is returned as `p - 1` from a function whose return type is `char *`. Making `p` a `const char *` would not compile without a cast. So the old constVariablePointer warning was a false positive. Before the PR, cppcheck skipped any `-` parent, which ignored this use. The PR now treats `p - 1` as a pointer result and follows it to the `return`, so the warning is correctly removed." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/e/ericw-tools/ericw-tools_2.0.0~alpha11+ds.orig.tar.xz", "main ericw-tools-2.0.0~alpha11/vis/flow.cc:201:22: style: Variable 'q' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "unclear", "confidence": "low", "explanation": "The PR changes how a pointer used with binary '-' is handled. Before, any '-' parent was skipped, so the pointer stayed a const candidate. Now the use is skipped only when the subtraction yields a non-pointer, and 'p - 1' / '*(p - 1)' are followed further. The removed warning means 'q' is now treated as possibly non-const through some subtraction. The shown excerpt ends before 'q' is used, so I cannot tell how it is used. If it is only a pointer difference such as 'q - portals.data()', the warning was likely a true positive lost through a missing valueType. If 'q - n' is stored into a non-const pointer, the old warning was a false positive. There is not enough context to decide." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/f/fastdds/fastdds_3.6.1+ds.orig.tar.xz", "main fastdds-3.6.1/src/cpp/rtps/history/TopicPayloadPool.hpp:268:24: style: Parameter 'data' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function returns `*reinterpret_cast(data - data_offset)`. If `data` were `const octet*`, then `data - data_offset` would also be const, and `reinterpret_cast` cannot cast away const to `NodeInfo*`, so the code would not compile. The pointee is also returned as a mutable reference. The old warning was therefore a false positive. Before the PR, any `-` parent was skipped; now pointer subtraction is followed into the non-const cast, so the false positive is gone." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/g/grpc/grpc_1.83.0.orig.tar.gz", "main grpc-1.83.0/third_party/upb/upb/wire/encode.c:79:51: style: Parameter 'ptr' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "In encode_growbuffer, 'ptr' is only used in the pointer difference 'e->limit - ptr'. That expression yields an integer and never writes through 'ptr', and 'ptr' is not returned or passed on. So it could be 'const char*', and the main warning was a true positive. The PR no longer skips every '-' parent unconditionally. It now skips only when the '-' expression has a known non-pointer valueType. Here the valueType is apparently missing (the 'e->limit' member is declared with the UPB_NODEREF macro), so the check falls through and treats 'ptr' as non-const. The warning disappearing is a new false negative, not a removed false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/i/inadyn/inadyn_2.11.0.orig.tar.gz", "main inadyn-2.11.0/plugins/duckdns.c:65:31: style: Variable 'p' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "`p` holds the result of `strstr()` and is only null-checked and used in the pointer subtraction `p - alias->name`. Nothing is ever written through it, so it could be `const char *` and the main warning was a true positive. The PR stops skipping `-` unconditionally. It now only skips when the `-` expression has a known non-pointer valueType. Here `alias->name` comes from a struct defined in a header, so the valueType of the subtraction is most likely unknown. The check then falls through and treats the use as non-const, losing a correct warning." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/l/linux-atm/linux-atm_2.5.1.orig.tar.gz", "main linux-atm-2.5.1/src/ilmid/asn1/exp_buf.c:526:11: style: Variable 'dataPtr' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "`dataPtr` is set to `data + len`, moved back with `dataPtr = dataPtr - bytesLeft`, and only ever passed as the source argument of `memcpy`. It is never written through, so `const char*` would work and main's warning was a true positive. The PR stops skipping pointer `-` expressions. The result of `dataPtr - bytesLeft` is assigned to a non-const pointer, which now makes the check treat `dataPtr` as non-const and drop the warning. This is a new false negative, not a removed false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/l/linux86/linux86_1.0.1+git20260515.8cf785f.orig.tar.xz", "main linux86-1.0.1+git20260515.8cf785f/as/genlist.c:107:21: style: Variable 'powers_of_10' can be declared as const array [constVariable]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "The static array 'powers_of_10' is only ever read, through '(powers_of_10 - 1)[power]', so it could be declared const and the removed warning was a true positive. The PR now treats '-' as pointer arithmetic. It no longer skips a '-' parent when the result is a pointer, but it does not follow the result into the '[' index access. Cppcheck therefore wrongly concludes the array may be modified, which is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libb/libbpf/libbpf_1.8.0.orig.tar.gz", "main libbpf-1.8.0/src/libbpf.c:8599:46: style: Parameter 'cur' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`find_prev_line` assigns `p = cur - 1` to a non-const `char *p` and returns it as `char *`. If `cur` were `const char *`, `cur - 1` would also be `const char *` and could not be assigned to `p` without a cast. The old warning was therefore a false positive, caused by ignoring pointer arithmetic with `-`. The PR now follows `cur - 1` like `+`, so the false positive is removed." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libd/libdfp/libdfp_1.0.17.orig.tar.gz", "main libdfp-1.0.17/libdecnumber/dpd/decimal64.c:746:9: style: Variable 'last' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "In decDigitsFromDPD, `last` only records a position (`last=uout`) and is then read, in the usual libdecnumber code: `dn->digits=(last-dn->lsu)*DECDPUN+1` and comparisons like `*last<10`. Nothing is ever written through `last`, so it could be `const Unit*` and main's constVariablePointer warning was a true positive. The PR removed `-` from the unconditional skip list and now skips only when the `-` result has a non-pointer value type. For the pointer difference `last-dn->lsu` that check apparently fails, perhaps because the value type is missing in C code. So the use is now treated as possibly non-const and the valid warning is lost, which is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libg/libglu/libglu_9.0.2.orig.tar.gz", "main glu-9.0.2/src/libtess/render.c:444:17: style: Variable 'vn' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "In upstream libglu, `vn` is only used as a loop bound (`vc < vn`) and in `for( vc = vn-1; vc > v0; --vc )`, where `vn-1` is assigned to the non-const `CachedVertex *vc`. Making only `vn` pointer-to-const would turn that assignment into a const-discarding conversion (a C constraint violation), so the warning is a false positive. The PR now treats pointer `-` like `+` and follows the result to its use, so it sees the assignment to non-const `vc` and drops the warning. This matches how Cppcheck already handles `p + n`." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libm/libmawk/libmawk_1.0.5.orig.tar.bz2", "main libmawk-1.0.5/scconfig/src/tmpasm/tmpasm_scconfig.c:272:41: style: Variable 'end' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "`end` is assigned `buff + strlen(buff)` and, as far as the shown code goes, is only read in the pointer difference `end - eopat[0]+1`. Nothing is ever written through it, so declaring it `const char *` would be valid and main's constVariablePointer warning looks like a true positive. The PR now sets `hasIncDecPlusMinus` for `-` and only skips `-` when the result type is known to be a non-pointer. If the type of `eopat` is not resolved here, that type is unknown, so the use is no longer skipped and `end` is treated as possibly non-const. The result is a new false negative, not a removed false positive. Confidence is medium because the rest of the loop after line 312 is not shown." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libn/libnbcompat/libnbcompat_20240319.orig.tar.gz", "main libnbcompat-20240319/regcomp.c:1270:8: style: Variable 'top' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "`top` is only read: it is assigned `&p->g->sets[...]` and then used in the comparison `cs == top-1`. Neither use writes through the pointer, so `const cset *top` would be valid C, and the removed warning was a true positive. The PR stops skipping every binary `-`. It now only skips `-` when the result is not a pointer. `top-1` is a pointer, so the PR no longer recognizes this pointer-arithmetic-then-compare use as const and drops the warning. This is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libn/libnginx-mod-rtmp/libnginx-mod-rtmp_1.2.2+dfsg.orig.tar.xz", "main nginx-rtmp-module-1.2.2/ngx_rtmp_cmd_module.c:202:33: style: Variable 'p' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "In nginx-rtmp's ngx_rtmp_cmd_connect, `p` is only assigned from `ngx_strlchr(...)`, tested with `if (p)`, and used in `s->app.len = (p - s->app.data)`. None of these write through `p`, so `const u_char *p` would be valid and the old warning was a true positive. The PR makes pointer subtraction set `hasIncDecPlusMinus`. Here the `-` result is not dereferenced, and the new `continue` for non-pointer `-` results apparently does not fire (probably no valueType is set). So the use is now treated as non-const and the true positive is lost. This is a new false negative. The usage is recalled from upstream nginx-rtmp, because the shown excerpt does not include it." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libn/libnginx-mod-rtmp/libnginx-mod-rtmp_1.2.2+dfsg.orig.tar.xz", "main nginx-rtmp-module-1.2.2/ngx_rtmp_relay_module.c:853:37: style: Variable 'url_end' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "`url_end` is only assigned from `ngx_strlchr`, null-checked, and used in the pointer difference `url_end - ctx->url.data`. It is never used to write through, so it could be `const u_char *` and main's warning was a true positive. The PR's new handling of binary '-' drops it. The pointer-difference result's valueType is probably unknown here because nginx types are missing, so the new `pointer == 0` check doesn't fire and the variable is treated as non-const. This is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libs/libspf2/libspf2_1.2.10.orig.tar.gz", "main libspf2-1.2.10/src/libspf2/spf_id2str.c:45:25: style: Parameter 'p_end' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "In `SPF_record_stringify_data`, `p_end` is only used as a buffer-end bound in pointer differences such as `p_end - p <= 0` (and similar size calculations further on). Nothing is ever written through it, so `const char *p_end` would be valid and the removed constParameterPointer warning was a true positive. The PR now skips '-' only when the result's valueType is known to be a non-pointer. Some subtraction using `p_end` in this function probably lacks a known valueType, so cppcheck now bails out on the whole parameter. That makes this a new false negative, not a removed false positive. The same pattern also removed the `p_end` warning in `spf_expand.c`." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/m/mle/mle_1.8.1.orig.tar.gz", "main adsr-mle-623d6da/editor.c:2367:11: style: Variable 'rc_data_stop' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`rc_data_stop` is used in `eol = rc_data_stop - 1;`, and `eol` (a non-const `char*`) is later written through with `*eol = '\\0'`. If `rc_data_stop` were `const char*`, that assignment would drop const. Main skipped every `-` parent, so it missed this use and gave a false positive. The PR now skips `-` only when the result is not a pointer. The pointer result flowing into a non-const variable is now seen, so the false positive is gone." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/n/ncdc/ncdc_1.23.1.orig.tar.gz", "main ncdc-1.23.1/src/ui_textinput.c:362:13: style: Variable 'pos' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "At line 362, `pos` is only read. It is dereferenced (`*pos`, `*(pos-1)`), moved with `pos--`, compared, and used in the pointer difference `pos - ti->str->str` that gives a length. Nothing is ever written through it, so `const char *pos` would be valid and the warning was a true positive. The PR changed how a `-` parent is handled: it now continues only when the result's value type is known to be non-pointer, and it treats `*(p - 1)` as a dereference. `ti->str->str` comes from an unknown GLib struct, so the type of the difference is probably unknown. That likely makes the check bail out, and the correct warning is lost. This is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/o/openblas/openblas_0.3.34+ds.orig.tar.xz", "main OpenMathLib-OpenBLAS-e016600/driver/level2/trsv_U.c:71:14: style: Variable 'AA' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "In the default configuration (TRANSA not defined), `AA - (min_i - i - 1)` is passed to `AXPYU_K`. That is an axpy kernel whose x parameter is a non-const `FLOAT *`. Before the PR, the check skipped any pointer used under a binary `-`, so it missed this argument use and suggested making `AA` const. That suggestion is a false positive, because a `const FLOAT *` passed to the non-const kernel parameter would draw a const-discard warning or error. The PR now treats pointer subtraction like pointer addition and follows it into the function argument, so the false positive is gone." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/pd-ext13/pd-ext13_0.17.1.orig.tar.gz", "main pd-ext13_0.17.1/openpatch.c:46:13: style: Variable 'lastslash' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "`lastslash` receives `strrchr(...)` and is then only used in pointer differences (`lastslash - s->s_name`) and as the source argument `lastslash+1` to `strcpy`. Nothing is written through it, so it could be `const char*`, and the removed warning was a true positive. The PR no longer skips every binary `-` unconditionally. It only skips one whose result type is known to be a non-pointer. Here `t_symbol` comes from an unseen Pd header, so `s->s_name` has no known type. The difference therefore has no valueType and is no longer recognized as harmless, and the warning disappears. That is a new false negative, not a new false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/pd-ext13/pd-ext13_0.17.1.orig.tar.gz", "main pd-ext13_0.17.1/strippath.c:40:13: style: Variable 'lastslash' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "`lastslash` is never written through. It is only used in `lastslash - s->s_name` (pointer difference), in `lastslash + 1` as the const source argument of strcpy, and in a null check. So it can be `const char *`, and main's warning was a true positive. The PR stops skipping `-` unconditionally and now skips it only when the result's valueType is known to be a non-pointer. Here `s->s_name` comes from m_pd.h, which is likely not resolved, so the difference probably has no known valueType. That makes the check treat the use as non-const and drops a valid warning, which is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/php-horde-lz4/php-horde-lz4_1.0.10.orig.tar.gz", "main horde_lz4-1.0.10/lib/lz4.c:885:17: style: Variable 'oend' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`oend` is used in pointer arithmetic whose result is stored in a non-const pointer: `oexit = oend-MFLIMIT;`, where `oexit` is a `BYTE*`. If `oend` were declared `const BYTE*`, that assignment would not compile, so the old constVariablePointer warning was a false positive. Before the PR, any `-` parent was skipped. Now a pointer-typed `oend - X` result is tracked, Cppcheck sees the non-const use, and the warning is gone." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/r/r-cran-quantreg/r-cran-quantreg_6.1.orig.tar.gz", "main quantreg/src/mcmb.c:45:19: style: Variable 'v' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "The function `lvector` returns `v-nl+1`, and its return type is `unsigned int *` (non-const). If `v` were declared as pointer to const, that return would no longer compile, so the constVariablePointer warning was a false positive. Before the PR, a `-` parent was skipped unconditionally, so this use was missed. The PR now only skips `-` when the result is not a pointer, which is exactly the #15219 fix. Removing the warning is correct." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/r/rust-git-cinnabar/rust-git-cinnabar_0.7.3.orig.tar.gz", "main git-cinnabar-0.7.3/git-core/builtin/pack-objects.c:126:32: style: Parameter 'delta' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "In oe_set_delta_child, 'delta' is only null-checked and used in the pointer subtraction 'delta - pack->objects'. Neither use modifies the pointee, and C allows subtracting a non-const pointer from a const-qualified one. So 'const struct object_entry *delta' is valid and the warning was a true positive. The PR now skips a '-' parent only when its valueType is known to be non-pointer. Here the subtraction's type is probably not resolved (e.g. 'pack->objects' comes from a header that was not seen), so the variable is treated as non-const and the warning is lost. This is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/r/rust-git-cinnabar/rust-git-cinnabar_0.7.3.orig.tar.gz", "main git-cinnabar-0.7.3/git-core/builtin/pack-objects.c:136:27: style: Parameter 'delta' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "In oe_set_delta_sibling, 'delta' is only null-checked and used in the pointer difference `delta - pack->objects`. Neither use modifies the pointee, so declaring it `const struct object_entry *` would be valid, and the removed warning was a true positive. The PR now skips '-' only when the result's valueType is known and is not a pointer. Otherwise it treats the '-' like pointer arithmetic. Here the subtraction result's valueType is apparently missing, so the check now treats the use as possibly non-const and drops the warning. This is a new false negative, not a removed false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/r/rust-git-cinnabar/rust-git-cinnabar_0.7.3.orig.tar.gz", "main git-cinnabar-0.7.3/git-core/builtin/pack-objects.c:2660:31: style: Parameter 'e' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "In `oe_set_tree_depth`, `e` is only used in `e - pack->objects`, a pointer difference used as an array index. That does not modify `*e`, so `e` could be `const struct object_entry *`, and the old warning was a true positive. The PR no longer skips every `-` parent. It now skips only when the `-` expression has a known non-pointer valueType. Here the valueType of the difference is probably unknown (e.g. the `struct packing_data` declaration was not visible), so the check falls through and treats `e` as non-const. The result is a new false negative, not a removed false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/r/rust-git-cinnabar/rust-git-cinnabar_0.7.3.orig.tar.gz", "main git-cinnabar-0.7.3/git-core/builtin/pack-objects.c:837:31: style: Parameter 'e' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "In oe_layer(), 'e' is only used in the pointer subtraction `e - pack->objects` to compute an array index. Pointer difference works fine with a const-qualified operand, and nothing is written through 'e'. So 'e' could be `const struct object_entry *`, and main's warning was a true positive. The PR now treats this '-' usage as non-const, probably because the subtraction's valueType is missing and the new pointer==0 check is skipped. That drops a correct warning, which makes it a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/r/rust-git-cinnabar/rust-git-cinnabar_0.7.3.orig.tar.gz", "main git-cinnabar-0.7.3/git-core/builtin/pack-objects.c:98:26: style: Parameter 'delta' can be declared as pointer to const [constParameterPointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "In oe_set_delta, 'delta' is only null-checked and used in the pointer difference 'delta - pack->objects'. Neither use modifies the pointee, so 'struct object_entry *delta' could be declared as pointer to const, and the removed warning was a true positive. The PR stopped skipping every '-' parent and now skips it only when the '-' expression has a known non-pointer valueType. Here that type is apparently not resolved, so the variable is treated as non-const and the warning disappears. This is a new false negative, not a removed false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/r/rust-git-cinnabar/rust-git-cinnabar_0.7.3.orig.tar.gz", "main git-cinnabar-0.7.3/git-core/builtin/sparse-checkout.c:527:9: style: Variable 'slash' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "acceptable regression", "confidence": "high", "explanation": "The removed warning was a true positive. `slash` is only read: it is null-checked, compared with `e->pattern`, and used in the pointer subtraction `slash - e->pattern`. Nothing is ever written through it, so it could be `const char *`. The PR changed how a `-` parent is handled for pointers, and the warning is no longer reported for this read-only pointer-difference use. That is a new false negative, not a removed false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/r/rust-git-cinnabar/rust-git-cinnabar_0.7.3.orig.tar.gz", "main git-cinnabar-0.7.3/git-core/compat/nedmalloc/malloc.c.h:3887:9: style: Variable 'old_end' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "`old_end` is used in `char* rawsp = old_end - (...)`. The result is a non-const `char*` that flows through `asp` and `csp` into `sp` and `ss`, which are written to (`*ss = m->seg`, the header set via `set_size_and_pinuse_of_inuse_chunk`). Declaring `old_end` as `const char*` would discard the const qualifier when initializing `rawsp`. So the old constVariablePointer warning was a false positive. The PR now treats pointer subtraction that yields a pointer like pointer `+`, which correctly suppresses it." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/sendfile/sendfile_2.1b.20080616.orig.tar.gz", "main sendfile-2.1b/src/utf7.c:227:14: style: Variable 'cp2' can be declared as pointer to const [constVariablePointer]" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "cp2 walks the input string and is read through. Its pointer arithmetic is used two ways: `cp2-cp` gives an integer and is still skipped, and the later code (not shown) very likely has `cp = cp2 - 1;` or similar. Main skipped every `-` parent, so it ignored that pointer flowing into the non-const `char *cp`. Making cp2 `const char*` would then break that assignment, so main's warning was likely a false positive. The PR only skips `-` when the result is not a pointer, so it now sees the escape and drops the warning." } } ], "started": "2026-11-17 11:02:49 UTC", "runner": "aws-testrunner-3" }