{ "tokens": { "input": 390316, "cache_read": 104466, "cache_write": 9084, "output": 19967 }, "reviews": [ { "key": [ "https://ftp.debian.org/debian/pool/main/c/cbflib/cbflib_0.9.7+dfsg1.orig.tar.xz", "your cbflib-CBFlib-0.9.7/examples/cif2cbf.c:2284:130: style: Comparing expression of type 'char' against value 255. Condition is always true. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code compares `((char *)oarray)[elno] != (char)(~0)`. Both sides are `char`. On a signed-char platform, `(char)(~0)` is -1, which a `char` element can hold, so the condition is not always true; it is a real sentinel check. Cppcheck's value flow folded the cast to 255, as if `char` were unsigned. The PR now treats plain `char` as signed with a maximum of 127, so this wrong 255 looks out of range and produces a new false positive. Before the PR, `char` of unknown sign had a maximum of 255, so no warning was given." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/cbflib/cbflib_0.9.7+dfsg1.orig.tar.xz", "your cbflib-CBFlib-0.9.7/examples/cif2cbf.c:2284:90: style: Comparing expression of type 'char' against value 255. Condition is always true. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code compares a `char` element against `(char)(~0)`, which is the same `char` type. On a signed-char platform the cast yields -1; on an unsigned-char platform it yields 255. Either way the value is in range for `char`, and the comparison is a meaningful check for an all-ones sentinel. Cppcheck appears to give the cast the value 255 (as if `char` were unsigned), while the PR now treats plain `char` as signed when deciding the type range. This inconsistency produces a false 'always true' warning. The new warning is a false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/cbflib/cbflib_0.9.7+dfsg1.orig.tar.xz", "your cbflib-CBFlib-0.9.7/examples/cif2cbf.c:2297:130: style: Comparing expression of type 'char' against value 255. Condition is always true. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code compares `((char *)oarray)[elno] != (char)(~0)`. On a signed-char platform, `(char)(~0)` is -1, and a char element can certainly equal -1, so the condition is not always true. Cppcheck's value flow evaluates the cast as 255, apparently treating plain char as unsigned. The PR now uses the signed char range (max 127) for plain char on 's' platforms, so this wrong 255 value now triggers the warning. The result is a new false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/cbflib/cbflib_0.9.7+dfsg1.orig.tar.xz", "your cbflib-CBFlib-0.9.7/examples/cif2cbf.c:2297:90: style: Comparing expression of type 'char' against value 255. Condition is always true. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code compares a `char` element against `(char)(~0)`. On a signed-char platform that cast yields -1, the same type as the left side, so the condition is a real runtime check (it is false when the element is 0xFF/-1). Cppcheck's value flow evaluates `(char)(~0)` as 255, as if char were unsigned. The PR now treats plain char as signed with a maximum of 127, so it wrongly reports 255 as out of range and the condition as always true. This is a new false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/cbflib/cbflib_0.9.7+dfsg1.orig.tar.xz", "your cbflib-CBFlib-0.9.7/examples/cif2cbf.c:2434:132: style: Comparing expression of type 'char' against value 255. Condition is always true. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The line compares `((char *)oarray)[elno] != (char)(~0)`. With signed char, `(char)(~0)` is -1, so both sides are plain `char`: the comparison can be true or false and is not always true. Cppcheck evaluates the cast as 255. Under the new rule that plain `char` has a maximum of 127 when the platform default sign is signed, 255 is out of range, so it reports 'always true'. The PR's range change exposes a wrong value for the char cast and adds a false positive. The `(char *)` cast inside float-handling code looks like a separate bug in cbflib, but this warning does not describe it." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/d/ddcutil/ddcutil_2.2.7.orig.tar.gz", "your rockowitz-ddcutil-d6050d6/src/util/edid.c:375:51: style: Comparing expression of type 'char' against value 128. Condition is always true. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "`s` is a plain `char*`. With the default signed-char platform, `s[ndx]` can only hold -128..127, so `s[ndx] < 128` is indeed always true. The new warning is factually correct for the analyzed platform and is exactly what the PR (#11592) intends to report. It also points at a real portability quirk: the comparison only does something on platforms where char is unsigned, and the comment's intent (\"value > 127\") is better expressed by casting to unsigned char. One could argue the check is deliberately portable, which lowers confidence somewhat, but the message is accurate." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/l/lcdproc/lcdproc_0.5.9.orig.tar.gz", "your lcdproc-0.5.9/server/drivers/tyan_lcdm.c:822:24: style: Comparing expression of type 'char' against value 241. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code compares `key_str[0] == (char) TYAN_LCDM_CMD_BEGIN`, where TYAN_LCDM_CMD_BEGIN is 0xF1 (241), as the message shows. The explicit `(char)` cast turns it into -15 on platforms where char is signed, so both sides are char and the comparison can be true when the device sends 0xF1. Cppcheck apparently ignores the cast's truncation and treats the value as 241. With the new signed-char range check, it then wrongly reports the condition as always false. This is a new false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/l/lcdproc/lcdproc_0.5.9.orig.tar.gz", "your lcdproc-0.5.9/server/drivers/tyan_lcdm.c:824:24: style: Comparing expression of type 'char' against value 242. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code compares `key_str[3]` with `(char) TYAN_LCDM_CMD_END`, where the constant is 0xF2. The explicit cast makes the right-hand side a char too. On a signed-char platform it becomes -14, so `key_str[3]` can equal it and the condition is not always false. Cppcheck uses the uncast value 242 for the cast expression and reports a false positive. The PR's new signed-char handling exposes this cast case." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp:169:24: style: Comparing expression of type 'char' against value 220. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code compares `n[4]` with `char(0xDC)`. The right-hand side is explicitly cast to `char`, so on a platform where char is signed it becomes -36, which is exactly what `n[4]` can hold. The comparison is meaningful and not always false. Cppcheck apparently keeps the known value of `char(0xDC)` as 220 and ignores the narrowing cast. The PR's new handling of plain signed `char` turns that wrong value into a new compareValueOutOfTypeRangeError. This is a false positive, and it repeats across many similar lines in these test files." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp:178:24: style: Comparing expression of type 'char' against value 255. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The line compares `n[1] == char(0xFF)`. Both sides are `char`. On a signed-char platform, `char(0xFF)` is -1, so the comparison can be true, and the test expects it to be true. Cppcheck wrongly treats the functional cast `char(0xFF)` as having the value 255. The PR's new signed-char handling then reports the condition as always false. This is a false positive, and the same pattern produces many more like it in these test files." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp:310:24: style: Comparing expression of type 'char' against value 220. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The assertion compares `n[5]` against `char(0xDC)`. Both operands are `char`, so with signed char the cast yields -36. After promotion `n[5]` can equal that value, so the condition is not always false. Cppcheck appears to treat the cast's known value as 220 and ignores the conversion to `char`. The PR's new signed-char handling then reports it as out of range. The same false positive appears on many similar `char(0x..)` comparisons in this package." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf16_out.pass.cpp:318:24: style: Comparing expression of type 'char' against value 254. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "Line 318 is `n[1] == char(0xFE)`. The right-hand side is an explicit cast to char. With a signed char, char(0xFE) is -2, so the comparison is between two chars and can be true. Cppcheck evidently lost or ignored the cast and treated the constant as 254, so it reports a condition that is always false. That is wrong: this is a standard test idiom and the assert is meaningful. The PR makes plain 'char' signed under this platform setting and now flags these explicitly cast comparisons. The result is a new false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp:135:24: style: Comparing expression of type 'char' against value 133. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code compares `n[5] == char(0x85)`. Both operands are `char`, because the constant is explicitly cast to `char`. With signed char, `char(0x85)` becomes -123, the same value stored in `n[5]`, so the assert can pass. The comparison is not always false. Cppcheck treats the cast expression as the value 133 instead of applying the char conversion. The new signed-char handling in this PR then reports a false positive. Many similar new warnings in this file have the same `char(0x..)` pattern." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp:146:24: style: Comparing expression of type 'char' against value 209. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The line compares `n[3] == char(0xD1)`. Both sides have type char, so the comparison can be true; this test asserts exactly that the encoder wrote byte 0xD1. Cppcheck evaluates the functional cast `char(0xD1)` as 209 instead of -47, which is what a signed char holds. The PR now treats plain char as signed, so 209 looks out of range and the check reports 'always false'. That is a false positive, and the same flaw produces the many similar new warnings in this package." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp:182:24: style: Comparing expression of type 'char' against value 128. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The line compares `n[2] == char(0x80)`. Both sides have type char: the literal is explicitly cast with `char(0x80)`, which gives -128 when char is signed. The two values are compatible and the assert is meaningful, so the condition is not always false. Cppcheck seems to take the cast value as the integer 128 and does not apply the narrowing to char. The new signed-char max-value logic then flags it. This false positive repeats on many lines of the libc++ test files that use the common `char(0xNN)` idiom." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp:183:24: style: Comparing expression of type 'char' against value 131. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "Line 183 compares `n[3] == char(0x83)`. Both sides are char: `char(0x83)` converts the value to char, giving -125 when char is signed. So the comparison is always well-defined and can be true. Cppcheck appears to treat the known value of the cast as 131 instead of the wrapped char value, so the new rule (plain char is signed, max 127) wrongly reports that the condition is always false. This is a false positive, and the same pattern repeats across many lines of these test files." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp:247:24: style: Comparing expression of type 'char' against value 209. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code compares `n[0] == char(0xD1)`. Both operands are `char`, and the right side is explicitly cast, so on a signed-char platform it becomes -47, which matches what is stored in `n[0]`. The condition can be true, so it is not always false. Cppcheck wrongly treats the known value of `char(0xD1)` as 209, ignoring the cast's truncation. The PR's new signed-char handling then turns this into a false positive (repeated across many similar test lines)." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp:292:24: style: Comparing expression of type 'char' against value 133. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code is `n[5] == char(0x85)`, which compares a char with a char. On a platform where char is signed, `char(0x85)` evaluates to -123, the same value that n[5] holds after writing byte 0x85, so the assert can be true. Cppcheck's value for the casted literal is the untruncated 133, ignoring the explicit cast to char. Now that the PR treats plain char as signed, this produces a bogus 'condition is always false' warning. The PR therefore adds a false positive on these casted-literal comparisons." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp:302:24: style: Comparing expression of type 'char' against value 191. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "Line 302 compares n[2] with char(0xBF). The right operand is explicitly cast to char, so both sides have the same type and the same value (-65 on a signed-char platform). The comparison can be true and is meant to be. Cppcheck seems to have taken the value of the cast as 191 (0xBF) without applying the char conversion. Calling this condition 'always false' is a false positive that the new signed-char handling introduced." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp:305:24: style: Comparing expression of type 'char' against value 133. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "Line 305 is `n[5] == char(0x85)`. The constant is cast to char, so both operands have type char and the comparison is valid: on a signed-char platform char(0x85) becomes -123 and so does n[5]. Cppcheck appears to take the known value of `char(0x85)` as 133 and ignore the cast's sign conversion. With the new signed-char handling it then reports that the condition is always false. The assert is correct code, so this is a new false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp:319:24: style: Comparing expression of type 'char' against value 131. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code is `assert(n[6] == char(0x83));`, which compares a `char` with a value cast to `char`. Both sides go through the same conversion, so on a signed-char platform both are -125 and the condition can be true. This test asserts exactly that. Cppcheck gives the cast expression the value 131 instead of truncating it to char range. The PR now treats plain `char` as signed with a maximum of 127, so it reports that 131 is out of range. The warning is a new false positive. Many identical ones appear in these codecvt tests." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp:66:24: style: Comparing expression of type 'char' against value 209. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code compares `n[0]` with `char(0xD1)`. Both sides are `char`, so with signed char the cast gives -47 and the comparison is meaningful. It can be true when the converter writes byte 0xD1. Cppcheck takes the cast's value as 209 and, with the new signed-default-char handling, reports that `char` can never equal 209. That is a false positive. The PR's new check is right for a plain integer literal like `c == 128`, but here the right side is already a `char` value. Many similar new warnings appear across these test files." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp:67:24: style: Comparing expression of type 'char' against value 147. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code compares `n[1] == char(0x93)`. Both sides are `char`: the cast converts 0x93 to char, giving -109 when char is signed. The comparison can therefore be true, and this test asserts exactly that. Cppcheck evaluates the cast as 147, ignoring the narrowing. With the PR's new treatment of plain char as signed, it now wrongly says the condition is always false. This is a new false positive, repeated many times across these files." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp:68:24: style: Comparing expression of type 'char' against value 133. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The comparison is `n[2] == char(0x85)`. The right-hand side is explicitly cast to char, so on a signed-char platform it becomes -123, the same value a char holding byte 0x85 has. The condition can be true, and in this test it is expected to be true. Cppcheck treats the cast value as 133 (no truncation for the cast) and now treats plain char as signed, so it reports 'always false'. That is a false positive, and the PR adds many of them across these codecvt tests." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_out.pass.cpp:78:24: style: Comparing expression of type 'char' against value 133. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The line compares `n[2] == char(0x85)`, so both operands are `char`. With signed char, `char(0x85)` is -123, which a `char` can hold, so the comparison can be true; it is exactly what the codec writes. Cppcheck keeps the value as 133 instead of applying the cast, and the PR's new signed-char range check then reports 'always false'. This is a new false positive, and the same pattern appears many times in this package." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp:131:24: style: Comparing expression of type 'char' against value 191. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code compares `n[2] == char(0xBF)`, so both operands are `char`. With a signed char, `char(0xBF)` is -65, and comparing it with `n[2]` is perfectly valid and can be true. Cppcheck appears to keep 191 as the known value of the cast expression instead of wrapping it to the char range. The PR now treats plain char as signed, so it wrongly reports the condition as always false. This is a new false positive, and it repeats across many lines of these test files." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp:154:24: style: Comparing expression of type 'char' against value 239. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code is `n[0] == char(0xEF)`. Both sides are `char`, so the constant is cast to `char` first. With signed char that gives -17, which fits the type, and the comparison is meaningful. Cppcheck appears to take 239 as the known value of `char(0xEF)`, ignoring the cast's truncation. The PR makes plain `char` count as signed, so this now reports 'always false'. That is a new false positive, repeated across many lines of these tests." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp:155:24: style: Comparing expression of type 'char' against value 187. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The line compares `n[1] == char(0xBB)`. Both operands have type char, so the condition can be true. On a signed-char platform, `char(0xBB)` is -69, which is in range and matches what codecvt writes into `n[1]`. Cppcheck appears to take the known value of the cast as 187, ignoring the narrowing conversion. With the new signed-char handling it then reports 'always false'. This is a false positive, and the same pattern produces many new false warnings throughout these test files." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp:165:24: style: Comparing expression of type 'char' against value 239. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "Line 165 compares `n[0]` (a `char`) with `char(0xEF)`. Both operands have type `char`, so on a signed-char platform both are -17 after promotion. If `n[0]` holds 0xEF, the comparison is true. Cppcheck evaluates the cast as the value 239 without truncating it to `char`. The new rule then treats plain `char` as signed and wrongly reports 'always false'. This is a new false positive, repeated many times across these libcxx test files." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp:166:24: style: Comparing expression of type 'char' against value 187. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code is `n[1] == char(0xBB)`. The right side is cast to char, so on a signed-char platform its value is -69, not 187. The comparison is char vs char and can be true; the test relies on exactly this. Cppcheck takes the known value 187 from the literal 0xBB and ignores the char cast's wraparound. With the new defaultSign=='s' handling it then reports the condition as always false. That is a false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp:239:24: style: Comparing expression of type 'char' against value 209. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code compares `n[0] == char(0xD1)`. The right-hand side is an explicit cast to char. On a signed-char platform `char(0xD1)` evaluates to -47, so the comparison is valid and can be true. Cppcheck seems to take the known value 209 from the cast operand and ignore the char truncation. It then reports a char compared against 209 as always false. The PR's new signed-char range handling now flags these comparisons, which adds many false positives on correct test code." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp:263:24: style: Comparing expression of type 'char' against value 191. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code compares `n[2] == char(0xBF)`, so both operands are `char`. With signed char, `char(0xBF)` is -65, the same value the byte holds, and the comparison can be true; the test relies on exactly that. Cppcheck ignores the cast and treats the value as 191. The PR now treats plain char as signed and range-checks it, so this newly reports 'always false'. That is a false positive, repeated across many lines that use the same `char(0x..)` pattern." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp:264:24: style: Comparing expression of type 'char' against value 241. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code compares `n[3] == char(0xF1)`. Both operands are `char`. On a signed-char platform, `char(0xF1)` is -15, so the comparison is between two values in the same range and can be true. Cppcheck ignores the cast and treats the right side as 241, so it wrongly says the condition is always false. The PR's new signed-char handling exposes this cast handling bug, producing many false positives in these codecvt tests." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp:267:24: style: Comparing expression of type 'char' against value 131. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code compares n[6] == char(0x83). The right operand is explicitly cast to char, so both sides are char. On a signed-char platform char(0x83) is -125, which n[6] can hold, so the comparison can be true. Cppcheck appears to take the known value of the cast as 131 instead of the wrapped -125, then flags it as out of range for signed char. This is a false positive; the PR's new signed-char handling now exposes the wrong value of the cast expression." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp:276:24: style: Comparing expression of type 'char' against value 191. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code compares `n[2] == char(0xBF)`. Both operands are `char`, so with signed char `char(0xBF)` is -65 and the comparison can be true. That is exactly what the test asserts after a successful conversion. Cppcheck wrongly takes the cast value as 191 instead of applying the char conversion. Combined with the new signed-char range logic, this yields a false 'always false' warning. These warnings are false positives." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp:297:24: style: Comparing expression of type 'char' against value 239. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code compares `n[0] == char(0xEF)`. Both operands are `char`. On a signed-char platform `char(0xEF)` is -17, so it fits in `char` and the comparison can be true; the test asserts exactly that. Cppcheck treats the cast expression as the value 239, which is wrong after the cast. The new signed-char handling in the PR then makes it report 'always false'. This is a new false positive, repeated across many lines of these test files." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp:299:24: style: Comparing expression of type 'char' against value 191. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code is `n[2] == char(0xBF)`. Both sides have type char. The cast makes the constant char(0xBF), which is -65 on a signed-char platform, so the comparison is valid and can be true. Cppcheck seems to have taken the known value 191 from the cast without applying the char conversion. With the new signed-char max of 127, it now wrongly reports that the condition is always false. This is a new false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/libc/libcudacxx/libcudacxx_1.8.1.orig.tar.gz", "your libcudacxx-1.8.1/libcxx/test/std/localization/locale.stdcvt/codecvt_utf8_utf16_out.pass.cpp:57:24: style: Comparing expression of type 'char' against value 131. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code is `n[3] == char(0x83)`. Both sides are `char`. The cast `char(0x83)` gives -125 on a signed-char platform, so the comparison is valid and can be true. Cppcheck apparently ignores the cast's effect on the value, treating the known value as 131 instead of -125. The PR now treats plain char as signed and reports that 131 is out of range. The warning is a false positive: the condition is not always false. This pattern (`char(0xNN)`) is common and correct." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/n/ncbi-igblast/ncbi-igblast_1.20.0.orig.tar.gz", "your ncbi-igblast-1.20.0-src/c++/src/objects/seqloc/Seq_id.cpp:82:25: style: Comparing expression of type 'const char' against value 127. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "`ch` is a plain `const char`. On the analyzed platform `char` is signed (defaultSign 's'), so its maximum value is 127 and `ch>127` can never be true. Non-ASCII bytes are negative there and are already caught by `ch<32`. The new warning is therefore correct for this platform and matches the PR's intent (#11592). It could be seen as noise, because the code is written to also work where `char` is unsigned, which is why confidence is medium." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/postgresql-19/postgresql-19_19~rc1.orig.tar.bz2", "your postgresql-19rc1/src/interfaces/libpq/fe-exec.c:4673:21: style: Comparing expression of type 'char' against value 255. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "`v1` is a plain `char` compared against `(char) -1`. On a signed-char platform that cast evaluates to -1, and `v1` is -1 whenever `get_hex` rejects the input, so the condition is not always false. Cppcheck's value flow gives `(char) -1` the value 255, apparently treating the char cast as unsigned. Before this PR the check used an unsigned range (max 255) for plain char, so 255 was in range and nothing was reported. The PR now uses a signed range (max 127) for plain char when the platform default is signed, so the wrong 255 value is flagged as out of range. The result is a new false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/postgresql-19/postgresql-19_19~rc1.orig.tar.bz2", "your postgresql-19rc1/src/interfaces/libpq/fe-exec.c:4676:14: style: Comparing expression of type 'char' against value 255. Condition is always true. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code compares `v2 != (char) -1`. Both sides are plain `char`, so the cast yields -1 when char is signed and 255 when char is unsigned. Either way `v2` can hold that value, since `get_hex` returns -1 for bad input, so the condition is not always true. Cppcheck seems to evaluate `(char)-1` as 255 while also treating `v2` as a signed char with a maximum of 127. That mixes the two conventions and produces this false positive. The PR's new signed-char handling for `UNKNOWN_SIGN` char exposes it." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/p/postgresql-19/postgresql-19_19~rc1.orig.tar.bz2", "your postgresql-19rc1/src/tools/pg_bsd_indent/io.c:154:13: style: Comparing expression of type 'char' against value 128. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code compares `*p == (char) 0200`. Where char is signed, the cast turns 0200 into -128, so the comparison is a valid check for the byte 0x80 and can be true. Cppcheck ignored the cast and treated the right-hand side as 128. With the new signed-char default it now reports 'always false'. This is a new false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/sfront/sfront_0.99.orig.tar.gz", "your sfront-0.99/src/lib/asys/wiretap.c:1428:11: style: Comparing expression of type 'char' against value 255. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "Column 11 points at the `ASYS_AUDIOUNIT_SINT32_BIGENDIAN` macro. The macro is not shown, but the warning means it expands to a plain `char` compared against 255, likely an endianness test such as `*(char*)&x == 0xFF`. The PR now treats plain `char` as signed when the platform default sign is signed. On such platforms (x86, and the macOS targets this AudioUnit code was written for), a `char` value can never equal 255, so the condition really is always false and the endianness test is broken. Before the PR, Cppcheck treated plain `char` as unsigned and missed this. The new warnings are therefore likely true positives. Confidence is medium because the macro definition is not visible." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/sfront/sfront_0.99.orig.tar.gz", "your sfront-0.99/src/lib/asys/wiretap.c:1436:11: style: Comparing expression of type 'char' against value 255. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "The warning is reported at the expansion of the macro ASYS_AUDIOUNIT_SINT32_BIGENDIAN. The macro definition is not shown, but the message says it compares a plain 'char' against 255. Before this PR, plain char with unknown signedness was treated as unsigned, so no warning was given. With a signed default char (as on x86 Linux, and on the Apple targets this AudioUnit code is meant for), a char only holds -128..127. So it can never equal 255, and the endianness test is always false. This looks like a real portability bug in the endianness check, and the new warning is a true positive that matches the PR's intent (#11592)." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/sfront/sfront_0.99.orig.tar.gz", "your sfront-0.99/src/lib/asys/wiretap.c:1444:11: style: Comparing expression of type 'char' against value 255. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "The macro ASYS_AUDIOUNIT_SINT32_BIGENDIAN is not shown, but by the message it expands to a comparison of a plain 'char' with 255, likely an endianness probe reading a byte of an integer. Where plain char is signed (the platform default here), a char holds -128..127, so '== 255' is always false. The endian test then always picks the little-endian branch. That is a real portability bug. The PR deliberately treats plain char as signed when the platform default is signed, so this new warning is a likely true positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/shishi/shishi_1.0.3.orig.tar.gz", "your shishi-1.0.3/extra/rsh-redone/rlogin.c:972:23: style: Comparing expression of type 'char' against value 128. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "Line 972 compares `*buf[1] == (char) 0x80`. Both sides are cast to `char`, so on a signed-char platform the right side is -128, which `*buf[1]` can hold. The comparison is true when the received out-of-band byte is 0x80, which is the window-size request the code is checking for. Cppcheck assigns the cast expression the value 128 instead of -128. The new signed-char handling in this PR then reports a condition that can actually be true as 'always false'. This is a new false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/spring/spring_106.0+dfsg.orig.tar.xz", "your spring-106.0/rts/lib/assimp/contrib/irrXML/CXMLReaderImpl.h:619:36: style: Comparing expression of type 'char' against value 239. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "In irrXML's readFile, `data8` is a plain `char*`, while `UTF8[]` is an `unsigned char` array holding 0xEF, 0xBB and 0xBF. Plain char is signed on this platform (defaultSign 's'). Promoted to int, `data8[0]` is therefore in -128..127 and can never equal 239. The whole UTF-8 BOM check is always false, so this is a real bug: UTF-8 files with a BOM are treated as ASCII. The pull request correctly treats a char of unknown sign as signed on such platforms, which exposes this true positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/spring/spring_106.0+dfsg.orig.tar.xz", "your spring-106.0/rts/lib/assimp/contrib/irrXML/CXMLReaderImpl.h:619:59: style: Comparing expression of type 'char' against value 187. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "In irrXML, `data8` is a plain `char*` buffer, while `UTF8[1]` is `unsigned char` 0xBB (187). On platforms where plain char is signed (e.g. x86, where `defaultSign` is 's'), `data8[1]` can only hold -128..127. After integer promotion it can never equal 187, so the UTF-8 BOM check is always false. This is a real portability bug: BOM detection silently fails. The PR correctly treats plain char as signed on such platforms, so this is a new true positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/s/spring/spring_106.0+dfsg.orig.tar.xz", "your spring-106.0/rts/lib/assimp/contrib/irrXML/CXMLReaderImpl.h:619:82: style: Comparing expression of type 'char' against value 191. Condition is always false. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "improvement", "confidence": "high", "explanation": "In irrXML's readFile, `data8` is a plain `char*` and `UTF8[]` is `const unsigned char {0xEF, 0xBB, 0xBF}`. In `data8[2] == UTF8[2]`, both operands are promoted to int. On platforms where plain char is signed (the default here, e.g. x86), `data8[2]` lies in -128..127 and can never equal 191. The UTF-8 BOM check is therefore always false there, which is a real portability bug in irrXML. The PR now treats plain char as signed when the platform default sign is signed, which is what makes this true positive appear." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/x/xalan/xalan_1.12.orig.tar.gz", "your xalan_c-1.12/src/xalanc/XMLSupport/XalanUTF8Writer.hpp:250:26: style: Comparing expression of type 'char' against value 128. Condition is always true. [compareValueOutOfTypeRangeError]" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "In XalanUTF8Writer, `value_type` is plain `char`. The PR now treats plain `char` as signed when the platform default is signed. There `theChar < 128` is always true: bytes 0x80\u20130xFF become negative and pass the assert. So the assert does not reject non-ASCII bytes as intended. That is a real, platform-accurate finding and matches the behaviour the PR added a test for. It is not a false positive, though the assert is meaningful on unsigned-char platforms." } } ], "started": "2026-10-15 17:23:52 UTC", "runner": "pc" }