2025-07-05 08:35 ftp://ftp.de.debian.org/debian/pool/main/p/phalanx/phalanx_25.orig.tar.gz cppcheck-options: --library=posix --library=gnu --library=bsd --inconclusive --enable=style,information --inline-suppr --template=daca2 --disable=missingInclude --suppress=unmatchedSuppression --check-library --debug-warnings --suppress=autoNoType --suppress=valueFlowBailout --suppress=bailoutUninitVar --suppress=symbolDatabaseWarning --suppress=normalCheckLevelConditionExpressions -D__GNUC__ --platform=unix64 -j6 platform: Linux-6.1.0-37-amd64-x86_64-with-glibc2.36 python: 3.11.2 client-version: 1.3.67 compiler: g++ (Debian 12.2.0-14+deb12u1) 12.2.0 cppcheck: head 2.17.0 head-info: 9b11b6b (2025-07-04 16:03:30 +0200) count: 126 126 elapsed-time: 1.7 1.7 head-timing-info: old-timing-info: head results: Phalanx-XXV/data.c:43:25: portability: Undefined behaviour, pointer arithmetic 'Th_-20' is out of bounds. [pointerOutOfBounds] Phalanx-XXV/data.c:55:25: portability: Undefined behaviour, pointer arithmetic 'Tv_-20' is out of bounds. [pointerOutOfBounds] Phalanx-XXV/data.c:78:16: portability: Undefined behaviour, pointer arithmetic 'HS_-20' is out of bounds. [pointerOutOfBounds] Phalanx-XXV/bcreate.c:62:10: debug: valueFlowConditionExpressions bailout: Skipping function due to incomplete variable stdout [valueFlowBailoutIncompleteVar] Phalanx-XXV/bcreate.c:163:12: debug: valueFlowConditionExpressions bailout: Skipping function due to incomplete variable EOF [valueFlowBailoutIncompleteVar] Phalanx-XXV/bcreate.c:224:39: debug: valueFlowConditionExpressions bailout: Skipping function due to incomplete variable EOF [valueFlowBailoutIncompleteVar] Phalanx-XXV/bcreate.c:281:15: debug: valueFlowConditionExpressions bailout: Skipping function due to incomplete variable optarg [valueFlowBailoutIncompleteVar] Phalanx-XXV/book.c:86:10: debug: valueFlowConditionExpressions bailout: Skipping function due to incomplete variable stderr [valueFlowBailoutIncompleteVar] Phalanx-XXV/book.c:418:39: debug: valueFlowConditionExpressions bailout: Skipping function due to incomplete variable EOF [valueFlowBailoutIncompleteVar] Phalanx-XXV/evaluate.c:232:18: debug: valueFlowConditionExpressions bailout: Skipping function due to incomplete variable stdin [valueFlowBailoutIncompleteVar] Phalanx-XXV/bcreate.c:161:10: style: Condition '!found' is always true [knownConditionTrueFalse] Phalanx-XXV/bcreate.c:158:22: note: Assignment 'found=0', assigned value is 0 Phalanx-XXV/bcreate.c:161:10: note: Condition '!found' is always true Phalanx-XXV/bcreate.c:111:10: warning: If resource allocation fails, then there is a possible null pointer dereference: tb1 [nullPointerOutOfResources] Phalanx-XXV/bcreate.c:109:12: note: Assuming allocation function fails Phalanx-XXV/bcreate.c:109:12: note: Assignment 'tb1=fopen("rbook.phalanx","rb")', assigned value is 0 Phalanx-XXV/bcreate.c:111:10: note: Null pointer dereference Phalanx-XXV/bcreate.c:395:13: style: Local variable 'i' shadows outer variable [shadowVariable] Phalanx-XXV/bcreate.c:370:6: note: Shadowed declaration Phalanx-XXV/bcreate.c:395:13: note: Shadow variable Phalanx-XXV/hash.c:15:23: style: Parameter 'm' can be declared as pointer to const [constParameterPointer] Phalanx-XXV/genmoves.c:584:8: style: Array index 'destination' is used before limits check. [arrayIndexThenCheck] Phalanx-XXV/genmoves.c:679:8: style: Array index 'destination' is used before limits check. [arrayIndexThenCheck] Phalanx-XXV/genmoves.c:206:8: style: Local variable 'square' shadows outer variable [shadowVariable] Phalanx-XXV/genmoves.c:310:5: note: Shadowed declaration Phalanx-XXV/genmoves.c:206:8: note: Shadow variable Phalanx-XXV/genmoves.c:219:6: style: Local variable 'destination' shadows outer variable [shadowVariable] Phalanx-XXV/genmoves.c:310:13: note: Shadowed declaration Phalanx-XXV/genmoves.c:219:6: note: Shadow variable Phalanx-XXV/genmoves.c:270:7: style: Local variable 'square' shadows outer variable [shadowVariable] Phalanx-XXV/genmoves.c:310:5: note: Shadowed declaration Phalanx-XXV/genmoves.c:270:7: note: Shadow variable Phalanx-XXV/genmoves.c:280:6: style: Local variable 'destination' shadows outer variable [shadowVariable] Phalanx-XXV/genmoves.c:310:13: note: Shadowed declaration Phalanx-XXV/genmoves.c:280:6: note: Shadow variable Phalanx-XXV/genmoves.c:432:8: style: Variable 'mov' can be declared as pointer to const [constVariablePointer] Phalanx-XXV/genmoves.c:605:8: style: Variable 'mov' can be declared as pointer to const [constVariablePointer] Phalanx-XXV/genmoves.c:701:8: style: Variable 'mov' can be declared as pointer to const [constVariablePointer] Phalanx-XXV/book.c:43:13: style: Local variable 'P' shadows outer variable [shadowVariable] Phalanx-XXV/phalanx.h:446:17: note: Shadowed declaration Phalanx-XXV/book.c:43:13: note: Shadow variable Phalanx-XXV/book.c:421:11: style: Local variable 'm' shadows outer argument [shadowArgument] Phalanx-XXV/book.c:394:17: note: Shadowed declaration Phalanx-XXV/book.c:421:11: note: Shadow variable Phalanx-XXV/book.c:422:31: style: Local variable 'n' shadows outer argument [shadowArgument] Phalanx-XXV/book.c:394:24: note: Shadowed declaration Phalanx-XXV/book.c:422:31: note: Shadow variable Phalanx-XXV/book.c:138:22: style: Parameter 'inp' can be declared as pointer to const [constParameterPointer] Phalanx-XXV/book.c:138:34: style: Parameter 'm' can be declared as pointer to const [constParameterPointer] Phalanx-XXV/learn.c:39:25: style: Variable 'bdepth' is assigned a value that is never used. [unreadVariable] Phalanx-XXV/levels.c:12:46: debug: valueFlowConditionExpressions bailout: Skipping function due to incomplete variable CLK_TCK [valueFlowBailoutIncompleteVar] Phalanx-XXV/io.c:144:16: debug: valueFlowConditionExpressions bailout: Skipping function due to incomplete variable stdin [valueFlowBailoutIncompleteVar] Phalanx-XXV/io.c:1103:16: debug: valueFlowConditionExpressions bailout: Skipping function due to incomplete variable SIG_IGN [valueFlowBailoutIncompleteVar] Phalanx-XXV/io.c:1154:21: debug: valueFlowConditionExpressions bailout: Skipping function due to incomplete variable stdin [valueFlowBailoutIncompleteVar] Phalanx-XXV/levels.c:27:22: style: Parameter 'l' can be declared as pointer to const [constParameterPointer] Phalanx-XXV/levels.c:112:7: style: int result is assigned to long variable. If the variable is long to avoid loss of information, then you have loss of information. [truncLongCastAssignment] Phalanx-XXV/levels.c:115:7: style: int result is assigned to long variable. If the variable is long to avoid loss of information, then you have loss of information. [truncLongCastAssignment] Phalanx-XXV/moving.c:102:36: portability: Undefined behaviour, pointer arithmetic 'cb_-20' is out of bounds. [pointerOutOfBounds] Phalanx-XXV/moving.c:51:31: style: Parameter 'm' can be declared as pointer to const [constParameterPointer] Phalanx-XXV/moving.c:92:23: style: Variable 'cb_' can be declared as const array [constVariable] Phalanx-XXV/moving.c:102:28: style: Variable 'cb' can be declared as pointer to const [constVariablePointer] Phalanx-XXV/moving.c:188:33: style: Parameter 'm' can be declared as pointer to const [constParameterPointer] Phalanx-XXV/phalanx.c:114:9: debug: valueFlowConditionExpressions bailout: Skipping function due to incomplete variable stdout [valueFlowBailoutIncompleteVar] Phalanx-XXV/killers.c:73:47: style: Parameter 'ht' can be declared as pointer to const [constParameterPointer] Phalanx-XXV/killers.c:77:8: style: Variable 'mpv' can be declared as pointer to const [constVariablePointer] Phalanx-XXV/killers.c:78:8: style: Variable 'mlv' can be declared as pointer to const [constVariablePointer] Phalanx-XXV/search.c:490:15: debug: valueFlowConditionExpressions bailout: Skipping function due to incomplete variable SIG_IGN [valueFlowBailoutIncompleteVar] Phalanx-XXV/static.c:43:36: portability: Undefined behaviour, pointer arithmetic 'sqcolor_-20' is out of bounds. [pointerOutOfBounds] Phalanx-XXV/static.c:56:28: portability: Undefined behaviour, pointer arithmetic 'pmpb_-20' is out of bounds. [pointerOutOfBounds] Phalanx-XXV/static.c:69:42: portability: Undefined behaviour, pointer arithmetic 'qstormtable_-20' is out of bounds. [pointerOutOfBounds] Phalanx-XXV/static.c:82:42: portability: Undefined behaviour, pointer arithmetic 'kstormtable_-20' is out of bounds. [pointerOutOfBounds] Phalanx-XXV/static.c:95:28: portability: Undefined behaviour, pointer arithmetic 'nmpb_-20' is out of bounds. [pointerOutOfBounds] Phalanx-XXV/static.c:108:21: portability: Undefined behaviour, pointer arithmetic 'nepb_-20' is out of bounds. [pointerOutOfBounds] Phalanx-XXV/static.c:121:28: portability: Undefined behaviour, pointer arithmetic 'bmpb_-20' is out of bounds. [pointerOutOfBounds] Phalanx-XXV/static.c:134:28: portability: Undefined behaviour, pointer arithmetic 'bepb_-20' is out of bounds. [pointerOutOfBounds] Phalanx-XXV/static.c:147:28: portability: Undefined behaviour, pointer arithmetic 'rmpb_-20' is out of bounds. [pointerOutOfBounds] Phalanx-XXV/static.c:160:28: portability: Undefined behaviour, pointer arithmetic 'qmpb_-20' is out of bounds. [pointerOutOfBounds] Phalanx-XXV/static.c:173:28: portability: Undefined behaviour, pointer arithmetic 'kmpb_-20' is out of bounds. [pointerOutOfBounds] Phalanx-XXV/static.c:186:28: portability: Undefined behaviour, pointer arithmetic 'kepb_-20' is out of bounds. [pointerOutOfBounds] Phalanx-XXV/static.c:198:33: portability: Undefined behaviour, pointer arithmetic 'outpost_-20' is out of bounds. [pointerOutOfBounds] Phalanx-XXV/static.c:318:8: style: Local variable 'i' shadows outer variable [shadowVariable] Phalanx-XXV/static.c:219:5: note: Shadowed declaration Phalanx-XXV/static.c:318:8: note: Shadow variable Phalanx-XXV/static.c:980:9: style: Local variable 'j' shadows outer variable [shadowVariable] Phalanx-XXV/static.c:756:6: note: Shadowed declaration Phalanx-XXV/static.c:980:9: note: Shadow variable Phalanx-XXV/static.c:1105:9: style: Local variable 'j' shadows outer variable [shadowVariable] Phalanx-XXV/static.c:756:6: note: Shadowed declaration Phalanx-XXV/static.c:1105:9: note: Shadow variable Phalanx-XXV/static.c:1308:7: style: Local variable 'j' shadows outer variable [shadowVariable] Phalanx-XXV/static.c:756:6: note: Shadowed declaration Phalanx-XXV/static.c:1308:7: note: Shadow variable Phalanx-XXV/static.c:1359:8: style: Local variable 'j' shadows outer variable [shadowVariable] Phalanx-XXV/static.c:756:6: note: Shadowed declaration Phalanx-XXV/static.c:1359:8: note: Shadow variable Phalanx-XXV/static.c:1417:8: style: Local variable 'j' shadows outer variable [shadowVariable] Phalanx-XXV/static.c:756:6: note: Shadowed declaration Phalanx-XXV/static.c:1417:8: note: Shadow variable Phalanx-XXV/static.c:241:17: style: Variable 'xknow' can be declared as pointer to const [constVariablePointer] Phalanx-XXV/static.c:243:13: style: Variable 'l' can be declared as pointer to const [constVariablePointer] Phalanx-XXV/static.c:572:18: style: Variable 'm' can be declared as const array [constVariable] Phalanx-XXV/static.c:753:9: style: Variable 'kdist' can be declared as pointer to const [constVariablePointer] Phalanx-XXV/static.c:932:15: style: Variable 'pp' can be declared as const array [constVariable] Phalanx-XXV/static.c:1311:14: style: Variable 'frb' can be declared as const array [constVariable] Phalanx-XXV/static.c:1402:15: style: Variable 'bon' can be declared as const array [constVariable] Phalanx-XXV/static.c:1482:15: style: Variable 'bon' can be declared as const array [constVariable] Phalanx-XXV/static.c:1514:15: style: Variable 'bon' can be declared as const array [constVariable] Phalanx-XXV/static.c:555:32: warning: Expression '-15' has a negative value. That is converted to an unsigned value and used in an unsigned calculation. [signConversion] Phalanx-XXV/static.c:556:18: warning: Expression '-6' has a negative value. That is converted to an unsigned value and used in an unsigned calculation. [signConversion] Phalanx-XXV/phalanx.c:179:7: warning: %i in format string (no. 1) requires 'int *' but the argument type is 'unsigned int *'. [invalidScanfArgType_int] Phalanx-XXV/phalanx.c:182:7: warning: %i in format string (no. 1) requires 'int *' but the argument type is 'unsigned int *'. [invalidScanfArgType_int] Phalanx-XXV/phalanx.c:489:1: warning: %i in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint] Phalanx-XXV/phalanx.c:400:19: warning: If memory allocation fails, then there is a possible null pointer dereference: LbookDir [nullPointerOutOfMemory] Phalanx-XXV/phalanx.c:399:20: note: Assuming allocation function fails Phalanx-XXV/phalanx.c:399:20: note: Assignment 'LbookDir=strdup(filename)', assigned value is 0 Phalanx-XXV/phalanx.c:400:19: note: Null pointer dereference Phalanx-XXV/phalanx.c:191:14: style: Local variable 't' shadows outer variable [shadowVariable] Phalanx-XXV/phalanx.c:76:9: note: Shadowed declaration Phalanx-XXV/phalanx.c:191:14: note: Shadow variable Phalanx-XXV/phalanx.c:48:41: style: Parameter 'env_variable' can be declared as pointer to const [constParameterPointer] Phalanx-XXV/phalanx.c:49:13: style: Parameter 'path' can be declared as pointer to const [constParameterPointer] Phalanx-XXV/phalanx.c:49:24: style: Parameter 'name' can be declared as pointer to const [constParameterPointer] Phalanx-XXV/search.c:274:4: style: Obsolescent function 'usleep' called. It is recommended to use 'nanosleep' or 'setitimer' instead. [prohibitedusleepCalled] Phalanx-XXV/search.c:89:16: style: Condition 'Depth>0' is always true [knownConditionTrueFalse] Phalanx-XXV/search.c:80:22: note: Assuming that condition 'Depth<=0' is not redundant Phalanx-XXV/search.c:89:16: note: Condition 'Depth>0' is always true Phalanx-XXV/search.c:311:7: style: Local variable 'i' shadows outer variable [shadowVariable] Phalanx-XXV/search.c:231:8: note: Shadowed declaration Phalanx-XXV/search.c:311:7: note: Shadow variable Phalanx-XXV/search.c:478:15: style: Local variable 'T1' shadows outer variable [shadowVariable] Phalanx-XXV/phalanx.h:426:13: note: Shadowed declaration Phalanx-XXV/search.c:478:15: note: Shadow variable Phalanx-XXV/search.c:307:20: style: Variable 'Alpha' is assigned a value that is never used. [unreadVariable] Phalanx-XXV/search.c:319:20: style: Variable 'Alpha' is assigned a value that is never used. [unreadVariable] Phalanx-XXV/evaluate.c:756:41: style: Obsolescent function 'usleep' called. It is recommended to use 'nanosleep' or 'setitimer' instead. [prohibitedusleepCalled] Phalanx-XXV/evaluate.c:300:43: style: Condition 'G[Counter].mtrl<400' is always true [knownConditionTrueFalse] Phalanx-XXV/evaluate.c:300:20: note: Assuming that condition 'G[Counter].mtrl<400' is not redundant Phalanx-XXV/evaluate.c:300:43: note: Condition 'G[Counter].mtrl<400' is always true Phalanx-XXV/evaluate.c:300:25: style: Same expression on both sides of '&&'. [duplicateExpression] Phalanx-XXV/evaluate.c:194:14: style: Local variable 'T1' shadows outer variable [shadowVariable] Phalanx-XXV/phalanx.h:426:13: note: Shadowed declaration Phalanx-XXV/evaluate.c:194:14: note: Shadow variable Phalanx-XXV/evaluate.c:195:6: style: Local variable 't' shadows outer variable [shadowVariable] Phalanx-XXV/evaluate.c:182:13: note: Shadowed declaration Phalanx-XXV/evaluate.c:195:6: note: Shadow variable Phalanx-XXV/evaluate.c:615:10: style: Local variable 't' shadows outer variable [shadowVariable] Phalanx-XXV/evaluate.c:182:13: note: Shadowed declaration Phalanx-XXV/evaluate.c:615:10: note: Shadow variable Phalanx-XXV/endgame.c:150:32: portability: Undefined behaviour, pointer arithmetic 'kbonus_-20' is out of bounds. [pointerOutOfBounds] Phalanx-XXV/endgame.c:333:18: portability: Undefined behaviour, pointer arithmetic 'nb_-20' is out of bounds. [pointerOutOfBounds] Phalanx-XXV/endgame.c:13:9: style: Variable 'tardist' can be declared as pointer to const [constVariablePointer] Phalanx-XXV/endgame.c:140:12: style: Variable 'kbonus_' can be declared as const array [constVariable] Phalanx-XXV/endgame.c:392:30: style: Variable 'wk' is assigned a value that is never used. [unreadVariable] Phalanx-XXV/io.c:798:21: style: Redundant condition: The condition '*f != '\0'' is redundant since '*f == ' '' is sufficient. [redundantCondition] Phalanx-XXV/io.c:808:21: style: Redundant condition: The condition '*f != '\0'' is redundant since '*f == ' '' is sufficient. [redundantCondition] Phalanx-XXV/io.c:822:21: style: Redundant condition: The condition '*f != '\0'' is redundant since '*f == ' '' is sufficient. [redundantCondition] Phalanx-XXV/io.c:853:21: style: Redundant condition: The condition '*f != '\0'' is redundant since '*f == ' '' is sufficient. [redundantCondition] Phalanx-XXV/io.c:870:21: style: Redundant condition: The condition '*f != '\0'' is redundant since '*f == ' '' is sufficient. [redundantCondition] Phalanx-XXV/io.c:1778:23: warning: Logical disjunction always evaluates to true: Abort != 0 || Abort != 4. [incorrectLogicOperator] Phalanx-XXV/io.c:592:15: style: Condition 'typ==3' is always true [knownConditionTrueFalse] Phalanx-XXV/io.c:590:19: note: Assuming that condition 'typ==2' is not redundant Phalanx-XXV/io.c:590:29: note: Assuming that condition 'typ==4' is not redundant Phalanx-XXV/io.c:592:15: note: Condition 'typ==3' is always true Phalanx-XXV/io.c:900:16: style: Condition 'Counter>0' is always false [knownConditionTrueFalse] Phalanx-XXV/io.c:874:14: note: Assignment 'Counter=0', assigned value is 0 Phalanx-XXV/io.c:900:16: note: Condition 'Counter>0' is always false Phalanx-XXV/io.c:1022:1: warning: %d in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint] Phalanx-XXV/io.c:1039:2: warning: %i in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint] Phalanx-XXV/io.c:1075:2: warning: %i in format string (no. 1) requires 'int' but the argument type is 'unsigned int'. [invalidPrintfArgType_sint] Phalanx-XXV/io.c:1855:4: style: 'continue' is redundant since it is the last statement in a loop. [redundantContinue] Phalanx-XXV/io.c:551:13: style: Local variable 'T1' shadows outer variable [shadowVariable] Phalanx-XXV/phalanx.h:426:13: note: Shadowed declaration Phalanx-XXV/io.c:551:13: note: Shadow variable Phalanx-XXV/io.c:597:8: style: Local variable 't' shadows outer variable [shadowVariable] Phalanx-XXV/io.c:552:6: note: Shadowed declaration Phalanx-XXV/io.c:597:8: note: Shadow variable Phalanx-XXV/io.c:665:14: style: Local variable 'T1' shadows outer variable [shadowVariable] Phalanx-XXV/phalanx.h:426:13: note: Shadowed declaration Phalanx-XXV/io.c:665:14: note: Shadow variable Phalanx-XXV/io.c:310:23: style: Parameter 'inp' can be declared as pointer to const [constParameterPointer] Phalanx-XXV/io.c:348:15: style: Variable 'ok' can be declared as const array [constVariable] Phalanx-XXV/io.c:349:15: style: Variable 'up' can be declared as const array [constVariable] Phalanx-XXV/io.c:444:22: style: Parameter 's' can be declared as pointer to const [constParameterPointer] Phalanx-XXV/io.c:444:32: style: Parameter 'm' can be declared as pointer to const [constParameterPointer] Phalanx-XXV/io.c:911:33: style: Parameter 's' can be declared as pointer to const [constParameterPointer] Phalanx-XXV/io.c:1623:17: style: Variable 'filename' can be declared as const array [constVariable] Phalanx-XXV/io.c:1649:10: style: Variable 'pm' can be declared as pointer to const [constVariablePointer] Phalanx-XXV/io.c:1672:12: style: Variable 'sd' can be declared as pointer to const [constVariablePointer] Phalanx-XXV/io.c:864:33: warning: Char literal compared with pointer 'f'. Did you intend to dereference it? [charLiteralWithCharPtrCompare] diff: DONE