cppcheck/test
rikardfalkeborn 13ffefc8b8 Valueflow: Fix right shift with more than 31 bits (#1553)
When comparing if the shift is large enough to make the result zero, use
an unsigned long long to make sure the result fits. Also, a check that
avoids setting the value if the shift is equal to or larger than the
number of bits in the operand (this is undefined behaviour). Finally,
add a check to make sure the calculated value is not too large to store.

Add test cases to cover this.

This was detected by an MSVC warning.

valueflow.cpp(1350): warning C4334: '<<' : result of 32-bit shift implicitly
                     converted to 64 bits (was 64-bit shift intended?)
2019-01-01 14:15:50 +01:00
..
cfg Fixed checkcfg: test/cfg/std.cpp:2904:error:uninitvar:Uninitialized variable: s 2018-12-23 18:09:55 +01:00
synthetic Improve Python code 2017-06-05 13:23:00 +02:00
CMakeLists.txt Add a check target to cmake (#1465) 2018-11-05 18:13:04 +01:00
options.cpp Updated copyright year 2018-01-14 15:37:52 +01:00
options.h Updated copyright year 2018-01-14 15:37:52 +01:00
redirect.h Updated copyright year 2018-01-14 15:37:52 +01:00
test.cxx
test64bit.cpp Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
testassert.cpp Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
testastutils.cpp Fix FP 8891: Incorrect return scope when using uniform initialization 2018-12-14 18:31:10 +01:00
testautovariables.cpp Fix issue 8910: Regression: ValueFlow: wrong conditional tokvalue 2018-12-29 09:31:21 +01:00
testbool.cpp Add check for return value of boolean function (#1451) 2018-11-01 11:08:16 +01:00
testboost.cpp Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
testbufferoverrun.cpp Disable the subfunction value flow analysis. It does not work well and needs to be rewritten. There are false positives. 2018-12-18 14:36:49 +01:00
testcharvar.cpp Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
testclass.cpp Improve trailing return type support. (#1520) 2018-12-13 06:34:10 +01:00
testcmdlineparser.cpp Improved const correctness of local variables. (#1396) 2018-09-24 15:08:16 +02:00
testcondition.cpp Fix issue 8905: Condition 'a==0' is always false 2018-12-18 08:16:43 +01:00
testconstructors.cpp Fixed #8835 (friend class and non-empty constructor: Uninitialized members not reported) (#1466) 2018-11-06 06:44:08 +01:00
testcppcheck.cpp Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
testerrorlogger.cpp --suppress on line 0 (#1354) 2018-09-18 12:58:14 +02:00
testexceptionsafety.cpp Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
testfilelister.cpp Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
testfiles.pri testrunner: Add testplatform to verify platform loading (#1176) 2018-04-18 16:12:35 +02:00
testfunctions.cpp Fix false positive: Invalid string argument with array (#1439) 2018-10-19 07:48:47 +02:00
testgarbage.cpp Fixed #8873 (Add syntaxError when there is no RHS for +-) 2018-12-01 17:29:41 +01:00
testimportproject.cpp Fixed #8864 (compile commands: handle define with string value) 2018-11-25 15:09:23 +01:00
testincompletestatement.cpp Fixed #8449 (False positive 'constStatement' when initializing std::unordered_map) 2018-11-12 18:10:34 +01:00
testinternal.cpp Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
testio.cpp Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
testleakautovar.cpp Fixed #8794 - Memory leak false positive triggered by !(x != NULL) (#1450) 2018-10-26 06:21:45 +02:00
testlibrary.cpp Rename Library::isargvalid() 2018-07-15 23:05:48 +02:00
testmathlib.cpp Correct detection of Microsoft extensions in MathLib::isValidIntegerSuffix. Remove public overloaded implementation which was not used outside mathlib.cpp. (#1531) 2018-12-20 12:20:31 +01:00
testmemleak.cpp Code cleanup 2018-12-17 18:54:32 +01:00
testnullpointer.cpp CTU: Avoid FP in else block 2018-12-31 08:24:39 +01:00
testoptions.cpp Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
testother.cpp isConstVarExpression: Fix FPs when there is C++ cast 2019-01-01 11:34:44 +01:00
testpath.cpp Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
testpathmatch.cpp Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
testplatform.cpp Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
testpostfixoperator.cpp Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
testpreprocessor.cpp Fixed handling of macros with known value defined in header file in configuration splitting (#8404) 2018-10-08 16:38:47 +02:00
testrunner.cpp Updated copyright year 2018-10-13 18:20:31 +02:00
testrunner.vcxproj Export interfaces from cppcheck-core.dll used from testrunner. In turn remove ctu sources from testrunner which are obsolete now. 2018-12-28 23:09:44 +01:00
testrunner.vcxproj.filters Export interfaces from cppcheck-core.dll used from testrunner. In turn remove ctu sources from testrunner which are obsolete now. 2018-12-28 23:09:44 +01:00
testsamples.cpp Fix Travis 2018-11-21 08:39:21 +01:00
testsimplifytemplate.cpp template simplifier: also check if instantiated template is not specialized (#1551) 2018-12-31 21:29:53 +01:00
testsimplifytokens.cpp Fix const anonymous struct. (#1527) 2018-12-18 08:15:12 +01:00
testsimplifytypedef.cpp Issue 6175: Check lifetime of a variables stored in containers and member variables 2018-11-21 08:43:57 +01:00
testsizeof.cpp Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
teststl.cpp Fix FP 8891: Incorrect return scope when using uniform initialization 2018-12-14 18:31:10 +01:00
teststring.cpp Disable the subfunction value flow analysis. It does not work well and needs to be rewritten. There are false positives. 2018-12-18 14:36:49 +01:00
testsuite.cpp Print test case name in assert 2018-12-21 13:55:24 +01:00
testsuite.h Print test case name in assert 2018-12-21 13:55:24 +01:00
testsuppressions.cpp Fixed compiler warning from VS2017: testsuppressions.cpp(450): warning C4458: declaration of 'errmsg' hides class member. (#1397) 2018-09-25 17:19:25 +02:00
testsymboldatabase.cpp template simplifier: remove explicit instantiations after instantiation (#1523) 2018-12-17 05:58:48 +01:00
testthreadexecutor.cpp Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
testtimer.cpp Fix testrunner compiling 2018-06-16 22:28:14 +02:00
testtoken.cpp Unused value: Fix false positive (ast, {}) 2018-12-14 18:56:09 +01:00
testtokenize.cpp Fixed #7203 (Better syntax error, handle array declaration with @) 2019-01-01 09:45:41 +01:00
testtokenlist.cpp Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
testtype.cpp Clarify warning 2018-12-23 12:42:18 +01:00
testuninitvar.cpp CTU: Find paths better 2018-12-30 16:23:25 +01:00
testunusedfunctions.cpp Fixed #8677 (False positive: unused method) 2018-08-08 11:31:35 +02:00
testunusedprivfunc.cpp Fixed #6183 (TemplateSimplifier: Does not handle methods) (#1546) 2018-12-29 11:19:53 +01:00
testunusedvar.cpp Fixed #8911 (Regression: False positive: Unassigned variable (alias)) 2018-12-30 20:20:20 +01:00
testutils.h Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
testvaarg.cpp Updated copyright year for modified files 2018-06-10 22:07:21 +02:00
testvalueflow.cpp Valueflow: Fix right shift with more than 31 bits (#1553) 2019-01-01 14:15:50 +01:00
testvarid.cpp Fixed #8627 (Tokenizer::setVarIdPass2: constructor parameter) 2018-12-02 09:28:05 +01:00