Daniel Marjamäki
4cccc710ef
Uninitialized variables; Fixed FP when bitmask is used on address
2021-05-24 20:55:13 +02:00
Robert Reif
c7be967769
fix #10295 (false negatives by inconsistent 'void' in argument list (declaration vs definition)) ( #3274 )
...
Co-authored-by: Robert Reif <reif@FX6840>
2021-05-24 19:32:15 +02:00
Daniel Marjamäki
d3bb84cd0e
Uninitialized variables; Added TP tests for ignored operators
2021-05-24 17:53:16 +02:00
Daniel Marjamäki
b7803ea6fb
Uninitialized variables; Fixed false positives for reference cast and dereferencing address of uninitialized variable
2021-05-24 17:50:28 +02:00
Daniel Marjamäki
4ad90bf6f1
Uninitialized variables; Fixed FP in inner for loop
2021-05-24 17:02:19 +02:00
Daniel Marjamäki
fa72ec20b2
Uninitialized variables; avoid false positives when passing uninitialized variable to unknown function
2021-05-24 15:54:09 +02:00
Daniel Marjamäki
a2e709a652
Uninitialized variables; Try to remove heuristics for assignment with overloaded <<. That is non-standard behavior for the << operator. Let's see how much FPs we get.
2021-05-24 13:17:50 +02:00
Daniel Marjamäki
3a498de306
extracttests; do not extract TestBufferOverrunterminateStrncpy tests
2021-05-24 13:17:29 +02:00
orbitcowboy
df6b0bcd87
#10026 : Added a regression test for 'false negative: duplicateExpression'
2021-05-24 08:54:45 +02:00
Paul Fultz II
ab50a75d8a
Fix 10289: ValueFlow; Wrong known value 'size_t - uint16_t > 0' ( #3273 )
2021-05-24 08:28:21 +02:00
Daniel Marjamäki
8ad0905e3b
Uninitialized variables; Fixed FP in valueflow-based checking
2021-05-23 18:43:34 +02:00
Daniel Marjamäki
f968761382
Uninitialized variables; Remove TODO comment in test, test is working as it should now.
2021-05-23 14:57:43 +02:00
Daniel Marjamäki
d64aea90fa
astyle formatting
2021-05-23 14:36:45 +02:00
Daniel Marjamäki
8828619855
Fixed #10293 (Uninitialized variables; False positive for array in union)
2021-05-23 12:06:23 +02:00
Daniel Marjamäki
85723f8605
Uninitialized variables; Different heuristic needed for const pointer function parameter
2021-05-23 11:45:47 +02:00
dummyunit
247b2d8c83
Support array types in template simplifier ( #3267 )
2021-05-23 10:40:09 +02:00
Paul Fultz II
47a4144b47
Fix 10288: ValueFlow; False positives because of wrong known value when there is sign cast ( #3268 )
2021-05-23 10:20:29 +02:00
Paul Fultz II
e2d9aaf23b
Fix 10286: false positive: uninitvar ( #3271 )
...
* Fix 10286: false positive: uninitvar
* Remove header
2021-05-23 07:58:19 +02:00
Paul Fultz II
8541e0503e
Fix 10290: false negative: container out of bounds ( #3269 )
2021-05-22 23:33:13 +02:00
Daniel Marjamäki
5f6b56ada2
buffer overrun; Fixed false negative for dynamically allocated float buffer
2021-05-22 15:39:20 +02:00
Daniel Marjamäki
87554bed7a
Redundant pointer op; Fixed false positives when macro is used
2021-05-22 14:18:29 +02:00
Daniel Marjamäki
9a9f14bd8a
Buffer overflow; Fixed FPs when array size is 1
2021-05-22 12:13:39 +02:00
Daniel Marjamäki
1cb48ad418
Uninitialized variables; Fixed false positive in sizeof()
2021-05-22 11:04:42 +02:00
Daniel Marjamäki
f5f3a8d4d7
Fix syntax errors in test cases
2021-05-22 09:44:18 +02:00
Paul Fultz II
c63aa2f2cc
Fix 10263: FP containerOutOfBounds when container is accessed via pointer ( #3265 )
2021-05-22 08:36:51 +02:00
Maksim Derbasov
f0d1822a83
Better handling functions with try block for throwInNoexceptFunction ( #3264 )
2021-05-22 08:36:28 +02:00
Paul Fultz II
1e3ab460a3
Fix 10254: false positive: arrayIndexOutOfBounds in inline function ( #3266 )
2021-05-22 08:20:09 +02:00
Daniel Marjamäki
22ae4543a6
Fixed 'make checkcfg'
2021-05-22 07:39:27 +02:00
Daniel Marjamäki
68c46e146d
Uninitialized variables; Fixed FP when returning malloc pointer
2021-05-21 17:10:49 +02:00
Daniel Marjamäki
2d3d7db730
Uninitialized variables; fix syntax errors in test cases
2021-05-21 15:30:52 +02:00
Daniel Marjamäki
1e6a574cff
Uninitialized variables; Passing address of uninitialized variable to function
2021-05-21 15:27:13 +02:00
Daniel Marjamäki
8adfcc848c
Uninitialized variables; check RHS expression
2021-05-21 14:31:25 +02:00
Daniel Marjamäki
cc74c8e1da
Uninitialized variables; Moved test case. ValueFlow can detect issue.
2021-05-21 10:42:58 +02:00
Paul Fultz II
5409fa8afd
Fix disabled valueFlowUninit tests ( #3262 )
2021-05-21 07:28:34 +02:00
Daniel Marjamäki
4746d4b819
Uninitialized variables; Improved checking of loops
2021-05-20 22:56:14 +02:00
Daniel Marjamäki
8e650e4243
Uninitialized variable; Fixed FP after unconditional scope with conditional initialization
2021-05-20 18:38:59 +02:00
Daniel Marjamäki
f1fff5e904
Fixed #10279 (ValueFlow/TokenList: function pointer dereference and call)
2021-05-20 13:54:17 +02:00
orbitcowboy
ef757e5cf9
#6952 : uninitvar - Added regression test cases
2021-05-20 09:14:17 +02:00
Robert Reif
3af3d7fc06
fix #10281 (Tokenizer; Wrong simplification for 'namespace ef = : 🅰️ 🅱️ :c::d::ef') ( #3263 )
2021-05-20 08:27:07 +02:00
Daniel Marjamäki
ca5fab8219
Uninitialized variables; Fixed false positive in range for loop
2021-05-19 21:12:11 +02:00
Daniel Marjamäki
abe810d718
Uninitialized variables; Fix false positive in switch inside loop
2021-05-19 13:07:04 +02:00
Daniel Marjamäki
e35c46bcb9
Uninitialized variables; Fixed false positive for overloaded & 'ar & a & b & c'
2021-05-18 21:03:43 +02:00
Daniel Marjamäki
216918756b
Fixed #10276 (FP: (style) Variable '((uint8_t*)(uint16_t)0x1000)[0]' is assigned a value that is never used.)
2021-05-18 20:35:00 +02:00
Daniel Marjamäki
0aebc32ae0
Uninitialized variables; Fixed false positive for 'cin >> x[0]'
2021-05-18 20:13:27 +02:00
Paul Fultz II
4b11bb4ad3
10278: ValueFlow: Wrong known value, sign conversion ( #3260 )
2021-05-18 07:28:45 +02:00
Daniel Marjamäki
bde8b4316e
Uninitialized variables; Fixed FP in range based for loop
2021-05-17 13:31:16 +02:00
Daniel Marjamäki
4322311482
Uninitialized variables; Fixed struct member access FP
2021-05-17 11:50:31 +02:00
Daniel Marjamäki
b115e4a932
Uninitialized variables; Fixed false positive in member assignment
2021-05-17 10:31:02 +02:00
Daniel Marjamäki
16ce0f1dbf
Uninitialized variables; Clarify warnings, bailout for binary & to avoid FPs
2021-05-17 09:22:19 +02:00
Daniel Marjamäki
224492b0b5
Uninitalialized variables; Avoid FP for void cast
2021-05-17 05:59:28 +02:00
keinflue
e93f8f140e
Regression tests for PR #3258 ( #3259 )
2021-05-17 05:35:16 +02:00
Daniel Marjamäki
6a0a2456b5
make checkcfg; temporarily disable suppressions
2021-05-16 22:48:22 +02:00
Daniel Marjamäki
e034fa8a6e
UninitVar: Rewrite CheckUninitVar::isVariableUsage(), use AST primarily
2021-05-16 22:27:04 +02:00
Daniel Marjamäki
2c155a7a78
Uninitialized variables; use AST
2021-05-16 11:58:51 +02:00
Daniel Marjamäki
e73057eb44
Fixed #10275 (ValueFlow: condition 'x>=0 && x < 10')
2021-05-16 10:34:22 +02:00
Daniel Marjamäki
2c10e0747a
extracttests: ensure error comment is written on proper line
2021-05-16 08:40:04 +02:00
Daniel Marjamäki
a07ea7e9e9
testbufferoverrun: refactor TODO test cases. Use TODO_ASSERT_EQUALS.
2021-05-15 21:08:07 +02:00
Daniel Marjamäki
a2ff7752b4
testbufferoverrun; refactor TODO test cases
2021-05-15 20:42:57 +02:00
Daniel Marjamäki
a40b85ccc6
testbufferoverrun: refactor TODO test case for strcat
2021-05-15 20:37:16 +02:00
Daniel Marjamäki
b8314289c6
testbufferoverrun; fixed TODO test cases for pointer arithmetic overflows
2021-05-15 20:32:46 +02:00
Daniel Marjamäki
680a1ee1b9
testbufferoverrun; remove TODO strncat/strcat test cases
2021-05-15 20:12:36 +02:00
Daniel Marjamäki
26e9525683
testbufferoverrun; test case cleanup, ensure there is not uninitialized reads etc
2021-05-15 15:35:14 +02:00
Daniel Marjamäki
e66427c395
testnullpointer; fix extracttests syntax error
2021-05-15 14:59:00 +02:00
Daniel Marjamäki
3c885df74d
testunusedvar: Remove test cases that have undefined behavior
2021-05-15 14:55:35 +02:00
orbitcowboy
e072c2d786
uninitvar: Added a regression test for #7736
2021-05-15 14:16:46 +02:00
Daniel Marjamäki
899b88754f
uninitialized variables; fix false positive in loop
2021-05-15 11:16:47 +02:00
Paul Fultz II
eb96e4980e
Fix issue 10268: ValueFlow; Wrong value in for loop ( #3257 )
2021-05-15 08:39:20 +02:00
Daniel Marjamäki
11c0cc3a6e
extracttests; Fix syntax error in new unit test
2021-05-14 22:29:15 +02:00
Daniel Marjamäki
105bb78775
CI; fix test/cfg/openmp.c
2021-05-14 22:16:54 +02:00
Daniel Marjamäki
809c70b9c3
uninitialized variables; fix FP in for loop
2021-05-14 21:36:51 +02:00
Daniel Marjamäki
404b82fc21
unused var; fix todo test cases, redundant assignment of array in loop
2021-05-14 19:07:30 +02:00
Daniel Marjamäki
56410c3d00
testunusedvar: fix mismatching allocation/deallocation in test
2021-05-14 14:01:39 +02:00
Daniel Marjamäki
c29997b117
uninitvar: fixed TODO assertion
2021-05-14 11:54:18 +02:00
Daniel Marjamäki
56bc5536aa
testunusedvar: move UB testcase to testuninitvar
2021-05-14 11:24:39 +02:00
Daniel Marjamäki
ffac1d1b00
testunusedvar.cpp: remove test cases that has undefined behavior
2021-05-14 11:06:44 +02:00
Daniel Marjamäki
45eb9f82a0
Fix CI; Cppcheck find some more unusedAllocatedMemory violations in test/cfg/..
2021-05-13 23:08:58 +02:00
Daniel Marjamäki
fd31f0846e
unused var; remove test case that has undefined behavior
2021-05-13 21:53:06 +02:00
Daniel Marjamäki
1def0d797b
extracttests: disable TestUnusedVar::localvar2 tests they do not make sense externally
2021-05-13 21:31:44 +02:00
Daniel Marjamäki
d549770b5b
updated extracttests.py. fix syntax errors in test cases.
2021-05-13 20:21:02 +02:00
Daniel Marjamäki
22ab9ccd7f
Fixed #10273 (False negative; Uninitialized variable in for loop)
2021-05-11 20:35:15 +02:00
Daniel Marjamäki
75311fba0f
Fixed #10218 (FP uninitvar with input from stringstream in for loop)
2021-05-10 19:48:07 +02:00
Daniel Marjamäki
db7be3e91b
Fixed #9810 (Improve check: uninitialized struct member not detected)
2021-05-10 19:24:03 +02:00
Daniel Marjamäki
c37b8ea55c
Fixed #8299 (false negative: uninitialized struct member)
2021-05-10 18:38:44 +02:00
Rikard Falkeborn
b013f1b3d0
Fix test case for #10186 ( #3253 )
2021-05-10 08:01:30 +02:00
Daniel Marjamäki
040069ab4d
Fixed Cppcheck self-check warnings
2021-05-09 23:27:53 +02:00
Daniel Marjamäki
2e2d766e2b
Fixed #6766 (Improve check; struct member is assigned value that is never used)
2021-05-09 20:09:10 +02:00
Daniel Marjamäki
3b37c14b3c
Parser; Partial C++20 support, explicit(bool)
2021-05-09 18:47:02 +02:00
Daniel Marjamäki
895a96f9dd
Tokenizer::findGarbageCode: detect wrong struct declaration
2021-05-08 15:28:21 +02:00
Daniel Marjamäki
a197e94573
Fixed #10266 (False positive; parameter can be const)
2021-05-08 13:40:52 +02:00
keinflue
0a84ad874c
Fix case ranges with single quotes and escape sequences ( #3248 )
2021-05-08 11:24:07 +02:00
keinflue
bfa26b5a72
Fix FP leakNoVarFunctionCall with passthrough returns ( #3249 )
2021-05-08 10:26:10 +02:00
Daniel Marjamäki
be95e2bf21
Fixed #10271 (AST; Token::astOperand2() cyclic dependency in static_assert)
2021-05-07 13:19:28 +02:00
Daniel Marjamäki
b8de69489d
Fixed #10079 (AST: switch does not have two operands)
2021-05-04 20:15:57 +02:00
Daniel Marjamäki
2f984b201a
AST; Fix wrong AST for initializer list
2021-05-04 19:02:29 +02:00
Daniel Marjamäki
08184f4681
Fixed #10070 (FP warning: Logical disjunction always evaluates to true)
2021-05-04 13:47:09 +02:00
dummyunit
661ebd3a96
Fix AST for brace initialization after decltype() ( #3245 )
...
Currently sub-expressions like decltype(x){} break AST creation for
subsequent tokens in the whole expression. In some cases this triggers
validation checks in validateAst() and analysis on the file stops.
For example, code like this:
int x = decltype(0){} ? 0 : 1;
currently produces internalAstError.
To fix the issue iscpp11init_impl() was changed to recognize { preceded
by decltype(expr) as a start of C++11 brace initialization expression.
2021-05-03 21:40:49 +02:00
Daniel Marjamäki
70ab30e3c6
AST; Fixed problem with initializer list and cleanup of compileScope
2021-05-03 20:22:08 +02:00
Daniel Marjamäki
7fefdf2bf7
astyle formatting
2021-05-03 16:34:55 +02:00
keinflue
f47fd20e14
Add test cases and improvements for PR #3240 . ( #3242 )
2021-05-03 10:45:37 +02:00
keinflue
6b8029633f
Fix build warnings and checkcfg errors with musl and libc++. ( #3244 )
...
* Fix musl include warning.
* Fix test/cfg errors with musl/libc++.
* Use correct C++ include for PR #3244
Co-authored-by: keinflue <>
2021-05-03 09:39:33 +02:00