Greetings everyone,
I hope I found you well.
I run `cppcheck -i tests -q --check-level=exhaustive .` and have found a number
of warnings and errors.
Here's the entire list of them:
c67-gen.c:1604:26: error: Array 'ParamLocOnStack[10]' accessed at index 10,
which is out of bounds. [arrayIndexOutOfBounds] fc = ParamLocOnStack[t] - 8;
^
c67-gen.c:1595:20: note: Assuming that condition 't<10' is not redundant
for (t = 0; t < NoCallArgsPassedOnStack; t++) {
^
c67-gen.c:1604:26: note: Array index out of bounds
fc = ParamLocOnStack[t] - 8;
^
c67-gen.c:1775:23: error: Array 'ParamLocOnStack[10]' accessed at index 10,
which is out of bounds. [arrayIndexOutOfBounds] fc = ParamLocOnStack[t] - 8;
^
c67-gen.c:1767:17: note: Assuming that condition 't<10' is not redundant
for (t = 0; t < NoCallArgsPassedOnStack; t++) {
^
c67-gen.c:1775:23: note: Array index out of bounds
fc = ParamLocOnStack[t] - 8;
^
c67-gen.c:382:13: warning: If resource allocation fails, then there is a
possible null pointer dereference: f [nullPointerOutOfResources] fprintf(f,
"%04X ", ind); ^
c67-gen.c:380:11: note: Assuming allocation function fails
f = fopen("TCC67_out.txt", "wt");
^
c67-gen.c:380:11: note: Assignment 'f=fopen("TCC67_out.txt","wt")', assigned
value is 0 f = fopen("TCC67_out.txt", "wt");
^
c67-gen.c:382:13: note: Null pointer dereference
fprintf(f, "%04X ", ind);
^
il-gen.c:21:2: error: #error this code has bit-rotted since 2003
[preprocessorErrorDirective] #error this code has bit-rotted since 2003
^
lib/armeabi.c:263:1: error: Shifting signed 32-bit value by 31 bits is
undefined behaviour [shiftTooManyBitsSigned] DEFINE__AEABI_XL2F(ul2f, 0)
^
lib/armeabi.c:266:1: error: Shifting signed 32-bit value by 31 bits is
undefined behaviour [shiftTooManyBitsSigned] DEFINE__AEABI_XL2F(l2f, 1)
^
lib/armeabi.c:337:1: error: Shifting signed 32-bit value by 31 bits is
undefined behaviour [shiftTooManyBitsSigned] __AEABI_XL2D(ul2d, 0)
^
lib/armeabi.c:340:1: error: Shifting signed 32-bit value by 31 bits is
undefined behaviour [shiftTooManyBitsSigned] __AEABI_XL2D(l2d, 1)
^
lib/armeabi.c:471:5: error: Shifting signed 32-bit value by 31 bits is
undefined behaviour [shiftTooManyBitsSigned] aeabi_lsr(val, shift, val.high >>
31, unsigned_int); ^
tccpp.c:3671:18: error: syntax error [syntaxError]
cstr_cat(cs,
^
riscv64-asm.c:1613:31: error: Array 'regs_allocated[16]' accessed at index 59,
which is out of bounds. [arrayIndexOutOfBounds] if (regs_allocated[reg]) {
^
riscv64-asm.c:1611:22: note: Assuming that condition
'i<sizeof(reg_saved)/sizeof(reg_saved[0])' is not redundant for(i = 0; i <
sizeof(reg_saved)/sizeof(reg_saved[0]); i++) { ^
riscv64-asm.c:1612:28: note: Assignment 'reg=reg_saved[i]', assigned value is 59
reg = reg_saved[i];
^
riscv64-asm.c:1613:31: note: Array index out of bounds
if (regs_allocated[reg]) {
^
riscv64-asm.c:1690:31: error: Array 'regs_allocated[16]' accessed at index 59,
which is out of bounds. [arrayIndexOutOfBounds] if (regs_allocated[reg]) {
^
riscv64-asm.c:1688:56: note: Assignment
'i=sizeof(reg_saved)/sizeof(reg_saved[0])-1', assigned value is 23 for(i =
sizeof(reg_saved)/sizeof(reg_saved[0]) - 1; i >= 0; i--) { ^
riscv64-asm.c:1689:28: note: Assignment 'reg=reg_saved[i]', assigned value is 59
reg = reg_saved[i];
^
riscv64-asm.c:1690:31: note: Array index out of bounds
if (regs_allocated[reg]) {
^
riscv64-asm.c:1902:22: error: Array 'regs_allocated[16]' accessed at index 18,
which is out of bounds. [arrayIndexOutOfBounds] if (!is_reg_allocated(reg))
^
riscv64-asm.c:1901:37: note: Assuming that condition 'reg<=18' is not redundant
else for (reg = 10; reg <= 18; reg++) {
^
riscv64-asm.c:1902:22: note: Array index out of bounds
if (!is_reg_allocated(reg))
^
riscv64-asm.c:1918:22: error: Array 'regs_allocated[16]' accessed at index 50,
which is out of bounds. [arrayIndexOutOfBounds] if (!is_reg_allocated(reg))
^
riscv64-asm.c:1917:37: note: Assuming that condition 'reg<=50' is not redundant
else for (reg = 42; reg <= 50; reg++) {
^
riscv64-asm.c:1918:22: note: Array index out of bounds
if (!is_reg_allocated(reg))
^
riscv64-asm.c:1941:45: error: Array 'regs_allocated[16]' accessed at index 18,
which is out of bounds. [arrayIndexOutOfBounds] if (!(regs_allocated[reg] &
REG_IN_MASK)) ^
riscv64-asm.c:1940:40: note: Assuming that condition 'reg<=18' is not redundant
for (reg = 10; reg <= 18; reg++) {
^
riscv64-asm.c:1941:45: note: Array index out of bounds
if (!(regs_allocated[reg] & REG_IN_MASK))
^
riscv64-asm.c:1975:41: error: Array 'regs_allocated[16]' accessed at index 50,
which is out of bounds. [arrayIndexOutOfBounds] if (!(regs_allocated[reg] &
REG_OUT_MASK)) ^
riscv64-asm.c:1974:36: note: Assuming that condition 'reg<=50' is not redundant
for (reg = 42; reg <= 50; reg++) {
^
riscv64-asm.c:1975:41: note: Array index out of bounds
if (!(regs_allocated[reg] & REG_OUT_MASK))
^
riscv64-asm.c:1981:41: error: Array 'regs_allocated[16]' accessed at index 18,
which is out of bounds. [arrayIndexOutOfBounds] if (!(regs_allocated[reg] &
REG_OUT_MASK)) ^
riscv64-asm.c:1980:36: note: Assuming that condition 'reg<=18' is not redundant
for (reg = 10; reg <= 18; reg++) {
^
riscv64-asm.c:1981:41: note: Array index out of bounds
if (!(regs_allocated[reg] & REG_OUT_MASK))
^
tccdbg.c:729:27: error: Shifting signed 64-bit value by 63 bits is undefined
behaviour [shiftTooManyBitsSigned] long long end = value >> 63;
^
tccdbg.c:754:27: error: Shifting signed 64-bit value by 63 bits is undefined
behaviour [shiftTooManyBitsSigned] long long end = value >> 63;
^
tccdbg.c:779:27: error: Shifting signed 64-bit value by 63 bits is undefined
behaviour [shiftTooManyBitsSigned] long long end = value >> 63;
^
tccgen.c:2351:37: error: Division by zero. [zerodiv]
uint64_t x = (a >> 63 ? -a : a) / (b >> 63 ? -b : b);
^
x86_64-gen.c:356:39: warning: Possible null pointer dereference: sym
[nullPointer] is_got = (op_reg & TREG_MEM) && !(sym->type.t & VT_STATIC);
^
x86_64-gen.c:1576:76: note: Calling function 'gen_modrm64', 4th argument 'NULL'
value is 0 gen_modrm64(0x89, arg_regs[reg_param_index], VT_LOCAL, NULL,
param_addr + i*8); ^
x86_64-gen.c:356:39: note: Null pointer dereference
is_got = (op_reg & TREG_MEM) && !(sym->type.t & VT_STATIC);
^
x86_64-gen.c:356:39: warning: Possible null pointer dereference: sym
[nullPointer] is_got = (op_reg & TREG_MEM) && !(sym->type.t & VT_STATIC);
^
x86_64-gen.c:963:64: note: Calling function 'gen_modrm64', 4th argument 'NULL'
value is 0 gen_modrm64(0x89, arg_regs[reg_param_index], VT_LOCAL, NULL, addr);
^
x86_64-gen.c:356:39: note: Null pointer dereference
is_got = (op_reg & TREG_MEM) && !(sym->type.t & VT_STATIC);
^
x86_64-gen.c:290:21: error: Null pointer dereference: sym [ctunullpointer]
get_tok_str(sym->v, NULL), c, r,
^
x86_64-gen.c:1838:35: note: Calling function 'gen_modrm', 3rd argument 'NULL'
value is 0 gen_modrm(6, vtop->r, NULL, vtop->c.i + (bt == VT_DOUBLE ? 7 : 3));
^
x86_64-gen.c:348:19: note: Calling function gen_modrm_impl, 3rd argument is null
gen_modrm_impl(op_reg, r, sym, c, 0);
^
x86_64-gen.c:318:3: note: Calling function gen_gotpcrel, 2nd argument is null
gen_gotpcrel(r, sym, c);
^
x86_64-gen.c:290:21: note: Dereferencing argument sym that is null
get_tok_str(sym->v, NULL), c, r,
^
nofile:0:0: information: Too many #ifdef configurations - cppcheck only checks
12 configurations. Use --force to check all configurations. For more details,
use --enable=information. [toomanyconfigs]
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel