{ "tokens": { "input": 347935, "cache_read": 89796, "cache_write": 17104, "output": 31192 }, "reviews": [ { "key": [ "https://ftp.debian.org/debian/pool/main/a/apache-arrow/apache-arrow_26.0.1.orig.tar.gz", "your apache-arrow-26.0.1/cpp/src/parquet/chunker_internal.cc:309:23: style: Argument '&def_level' to function Roll is always 1. It does not matter what value 'def_level' has. [knownArgument]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "The code passes `&def_level`, the address of a local variable, to `gearhash.Roll`, which reads the value through the pointer. It makes no sense to say the argument is \"always 1\" and that the value of `def_level` does not matter: the function hashes the pointed-to value, which changes every iteration. Before the PR, the check skipped this because `def_level` had ValueFlow values (likely impossible values). The PR now ignores impossible values, so the check fires on the address-of expression. This is a new false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/a/apache-arrow/apache-arrow_26.0.1.orig.tar.gz", "your apache-arrow-26.0.1/cpp/src/parquet/chunker_internal.cc:330:23: style: Argument '&def_level' to function Roll is always 1. It does not matter what value 'def_level' has. [knownArgument]" ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "`&def_level` is the address of a local variable. Its 'known value 1' is only the non-null truthiness of the pointer. That value means nothing for an argument passed to Roll, which reads the pointed-to data. The PR loosened the check from requiring that the variable has no values to requiring that it has no non-impossible int values. As a result, `&def_level` is now flagged, and the 'always 1' message is a false positive." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/b/bemenu/bemenu_0.6.23+dfsg.orig.tar.xz", "your Cloudef-bemenu-6f0fd2e/client/common/common.c:38:62: style: Argument 'i>c/2?c-i:i' to function fprintf is always 80. It does not matter what value 'c' has. [knownArgument]\n Cloudef-bemenu-6f0fd2e/client/common/common.c:34:22: note: Assignment 'c=80', assigned value is 80\n Cloudef-bemenu-6f0fd2e/client/common/common.c:38:62: note: Argument 'i>c/2?c-i:i' to function fprintf is always 80. It does not matter what value 'c' has." ], "verdict": { "verdict": "regression", "confidence": "high", "explanation": "In the loop `for (uint32_t i = 1; i < c - 1; ++i)` with c = 80, the expression `i > c/2 ? c-i : i` takes values from 1 to 40 and is never 80. The new 'always 80' knownArgument warning is a false positive caused by a bad known value from ValueFlow. Before this PR it was suppressed because 'i' has (impossible) values. The PR relaxed that check to ignore impossible values, which exposed this wrong warning." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/chibicc/chibicc_1.0.25.orig.tar.gz", "main chibicc-1.0.25/test/csmith_102.c:1051:118: style: Argument '(void*)0!=&g_303[l_1927+5][l_1927+6][g_1356]' to function safe_sub_func_uint64_t_u_u is always 1. It does not matter what value 'g_303[l_1927+5][l_1927+6][g_1356]' has. [knownArgument]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "The argument `(void*)0 != &g_303[...]` compares the address of an array element with NULL. That address can never be null, so the argument really is always 1, and the removed warning was technically correct. The PR now skips every comparison operator (`%comp%`) in checkKnownArgument, which is why this report disappears. The old message was also imprecise: the element's value is never read, only its address. Losing a valid but low-value report on csmith-generated code is a new false negative, so this is an acceptable regression." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/chibicc/chibicc_1.0.25.orig.tar.gz", "main chibicc-1.0.25/test/csmith_102.c:1631:334: style: Argument '&g_21[3]!=(void*)0' to function safe_mod_func_int8_t_s_s is always 1. It does not matter what value 'g_21[3]' has. [knownArgument]" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "`&g_21[3] != (void*)0` is not really an argument to `safe_mod_func_int8_t_s_s`. It is the discarded left operand of a comma operator inside the first argument. Cppcheck mistook the comma for an argument separator. The message is also misleading: it says 'it does not matter what value g_21[3] has', but the expression compares the address of an array element and never reads its value. A known-true pointer comparison like this is the job of the condition checks, not knownArgument. The PR now skips comparison tokens in this check, which removes this inaccurate, noisy warning." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/chibicc/chibicc_1.0.25.orig.tar.gz", "main chibicc-1.0.25/test/csmith_102.c:446:391: style: Argument '((-1L^(safe_mul_func_int8_t_s_s(*g_1556,p_11)))==(safe_rshift_func_int16_t_s_s(((((0xC0L==(((safe_mod_func_int32_t_s_s(-7L,*p_13),p_12)<=p_11)<18446744073709551607UL)),*l_2499),1UL)&&p_12),3)>=l_2586))!=3L' to function safe_mul_func_int16_t_s_s is always 1. It does not matter what value 'p_11' has. [knownArgument]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "The argument has the form `(A == B) != 3L`. The inner comparison can only yield 0 or 1, so the whole expression is always 1 regardless of p_11. The removed warning was therefore a true positive. The PR now skips every top-level comparison token in checkKnownArgument, to avoid condition-dependent false positives like `if (x != 5) g(x == 5);`. That is a deliberate trade-off, and losing this correct report is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/chibicc/chibicc_1.0.25.orig.tar.gz", "main chibicc-1.0.25/test/csmith_102.c:738:400: style: Argument '(((g_2141[5][1][2]|=((*l_2139)|=(l_2137^(((l_2117[0]=(l_2096|((((g_2138,0xC1765836L)<0x76FD9807L)>=p_15)^p_15)))|p_15)0x7381F6FBL)>l_2174[0])),0x1B1871ACL),p_15),l_2119),l_2137))))),l_2137),l_2118),p_15),*g_1749))&&(**g_552))&&1L)==g_956.f2.f1)||0xA903116FL))<0x1ED8L' to function safe_div_func_uint64_t_u_u is always 0. It does not matter what value 'l_2096' has. [knownArgument]" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "The argument is `(p_15, (... || 0xA903116FL)) < 0x1ED8L`. The comma yields the `||` result, which is 1, so the comparison `1 < 0x1ED8` evaluates to 1. The removed warning claimed the argument is 'always 0', which is a wrong value. It also blamed `l_2096`, a variable buried deep inside a short-circuited sub-expression. This is csmith-generated code where such constant comparisons are an artifact, not a user mistake. The PR now skips arguments whose top operator is a comparison, and this one is. Dropping an inaccurate, noisy knownArgument report is beneficial." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/chibicc/chibicc_1.0.25.orig.tar.gz", "main chibicc-1.0.25/test/csmith_275.c:1066:389: style: Argument '((safe_rshift_func_int32_t_s_u((((((*g_1882)--)&0x3347L)&&l_2206[7])||((*g_237,255UL)<=(g_794[3][0].f8,safe_rshift_func_int16_t_s_u(((p_21^(p_21|(((65535UL==((*g_1882)=(safe_mod_func_uint8_t_u_u(p_18&p_18,2L))))>l_2062)==0x9865A27E8BC2989FLL)))<=4294967288UL),5)))),21)>0x373E2314L)&&l_2206[7])>0xDAF8L' to function safe_mul_func_uint64_t_u_u is always 0. It does not matter what value 'l_2206[7]' has. [knownArgument]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "The argument is '(... && l_2206[7]) > 0xDAF8L'. The left operand is a logical && result, so it is always 0 or 1 and can never exceed 0xDAF8. The argument really is always 0 no matter what l_2206[7] holds, so the removed warning was a true positive. It disappears because the PR now skips every top-level comparison operator in checkKnownArgument, not because the warning was wrong. That makes this a new false negative, which is acceptable given that the PR's goal is to suppress comparison-based false positives." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/chibicc/chibicc_1.0.25.orig.tar.gz", "main chibicc-1.0.25/test/csmith_275.c:1128:313: style: Argument '(~(safe_sub_func_int64_t_s_s((l_2178[1]&&(p_21&=((0x99F3L!=((((g_2283,l_2284)==l_2285)&&(*g_269))&&p_19)),g_2286))),p_18)<=-1L))>(*g_36)' to function safe_mul_func_uint32_t_u_u is always 0. It does not matter what value 'p_21' has. [knownArgument]" ], "verdict": { "verdict": "improvement", "confidence": "medium", "explanation": "The argument's top-level operator is a comparison: `(~(...<= -1L)) > (*g_36)`. The PR now skips comparison tokens in checkKnownArgument, which is why this warning disappears. The 'always 0' claim is doubtful. The left side is ~0 or ~1 (-1 or -2), and it is compared against the unknown `*g_36`, so the result depends on that value and on its type. The message is also misleading: it says the value of p_21 does not matter, yet the expression assigns to p_21 (`p_21 &= ...`), and that side effect is the opposite of 'disabled/hidden'. Removing this noisy, likely false warning is good." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/chibicc/chibicc_1.0.25.orig.tar.gz", "main chibicc-1.0.25/test/csmith_275.c:1941:951: style: Argument '(((l_923[0]=((*g_876)=(safe_mul_func_uint64_t_u_u(l_886[0],(safe_rshift_func_int32_t_s_u(safe_sub_func_uint16_t_u_u(((l_903=((**g_445)=(safe_unary_minus_func_int8_t_s((!(safe_sub_func_int16_t_s_s((l_886[1]|(safe_add_func_uint8_t_u_u(((*l_907)=((*l_904)++,p_59)),((safe_mul_func_uint8_t_u_u((safe_rshift_func_int8_t_s_u(0x55L,0)&(safe_add_func_uint32_t_u_u(*p_62,safe_sub_func_uint64_t_u_u(((!((safe_div_func_int64_t_s_s((((l_903>=(safe_div_func_int32_t_s_s(safe_div_func_int64_t_s_s(l_886[1],++(*l_924)),l_927))),-1L)&&l_927),p_60),65527UL)|0UL))|p_61),p_61)))),l_923[0])<=l_886[0])==0xC4CCL))>p_61)),p_59),l_923[0]))))))^(*p_62)),p_60),2)^l_928))))),0x8C38AC1DL)==(*p_62))>0x3DL' to function safe_add_func_uint8_t_u_u is always 0. It does not matter what value 'l_923[0]' has. [knownArgument]" ], "verdict": { "verdict": "acceptable regression", "confidence": "medium", "explanation": "The argument has the form `((... , 0x8C38AC1DL) == (*p_62)) > 0x3DL`. An `==` result is 0 or 1, so it can never be greater than 0x3D (61), and the argument really is always 0. The PR now skips every top-level comparison in checkKnownArgument (`%comp%`), so this true positive is no longer reported. The named variable `l_923[0]` is a slightly odd choice because it is an assignment target, but the core claim is correct. Losing the warning is a new false negative." } }, { "key": [ "https://ftp.debian.org/debian/pool/main/c/chibicc/chibicc_1.0.25.orig.tar.gz", "main chibicc-1.0.25/test/csmith_275.c:2108:359: style: Argument '((g_72.f0,(safe_sub_func_uint32_t_u_u((g_43[4].f1==((safe_mod_func_uint64_t_u_u(p_70,safe_lshift_func_int64_t_s_s(safe_div_func_uint8_t_u_u(~(l_128!=l_129[1]),p_70^p_70),50))^-5L)<0xAC23FC00924423CCLL)),0xEBE71B68L)