Re: bitpos expansion patches summary

Jan Kratochvil
2012-09-02T18:15:52Z

Hi Siddhesh,

another part, close to the end.

http://people.redhat.com/jkratoch/bitpos3.patch
- so far only FYI - annotations to the patch file.
^x lines are justifications of the change according to non-safe
splint-bitpos2.locdiff.report record below.
^y only a few of them - review of changes listed below.
yBAD means I do not agree with the change, explained below.
It will need to be all annotated before a check-in.

[part below was already sent off-list]
We will need to re-run splint on top of FSF HEAD and then re-use the already
processed '.locdiff.report' lines but still see the newly introduced splint
warnings.

I did not yet get to this point as I still process the "old" codebase
2636a39d8bf9b24dce328e4f906e8710b52d2105 but it will need to be done before
check-in. For:
* newly introduced splint warnings by the int->LONGEST&co. expansion
* newly introduced FSF HEAD code since the last splint run

I was thinking about some updating of file:lineno records in '.locdiff.report'
file to their new location and then diffing the old+reviewed '.locdiff.report'
against new file. But I have not tried it yet in practice.

Thanks,
Jan

SAFE(Register type): (mips-tdep.c:876): VARINIT(len): (ULONGEST to int) [(type)->length]
SAFE(Likewise): (mips-tdep.c:908): VARINIT(len): (ULONGEST to int) [(type)->length]
SAFE: (mips-tdep.c:4318): FUNC(store_signed_integer): (CORE_ADDR to LONGEST) [make_compact_addr(addr)]
SAFE: (mips-tdep.c:4400): FUNC(phex): (LONGEST to int) [len]
SAFE: (mips-tdep.c:4414): VARINIT(odd_sized_struct): (boolean to int) [(len > regsize && len % regsize != 0)]
SAFE: (mips-tdep.c:4422): VARINIT(partial_len): (LONGEST to int) [(len < regsize ? len : regsize)]
SAFE: (mips-tdep.c:4444): ASSIGN: (LONGEST to int) [ longword_offset = regsize - len]
SAFE: (mips-tdep.c:4447): CMP: (int to ULONGEST) [(arg_type)->length < regsize]
SAFE: (mips-tdep.c:4448): ASSIGN: (LONGEST to int) [ longword_offset = regsize - len]
SAFE(Structs dont reach here): (mips-tdep.c:4565): CMP: (ULONGEST to int) [offset < (type)->length]
SAFE(Likewise): (mips-tdep.c:4569): CMP: (ULONGEST to int) [offset + xfer > (type)->length]
SAFE(Likewise): (mips-tdep.c:4570): ASSIGN: (ULONGEST to int) [ xfer = (type)->length - offset]
FIXED(Expand len): (mips-tdep.c:4701): VARINIT(len): (ULONGEST to int) [(arg_type)->length]
- You have fixed line 4646 but I do not see line 4701 to be fixed.
SAFE: (mips-tdep.c:4937): CMP: (int to ULONGEST) [(type)->length > 2 * MIPS64_REGSIZE]
SAFE: (mips-tdep.c:4970): FUNC(mips_xfer_register): (ULONGEST to int) [(type)->length]
SAFE: (mips-tdep.c:5020): FUNC(mips_xfer_register): (ULONGEST to int) [((((type)->main_type->flds_bnds.fields[field]).type))->length]
SAFE(Length < 2*MIPS64_REGSIZE): (mips-tdep.c:5036): CMP: (ULONGEST to int) [offset < (type)->length]
FIXED(expand offset): (mips-tdep.c:5040): CMP: (ULONGEST to int) [offset + xfer > (type)->length]
- I do not see a need for this change, it is all limited by:
TYPE_LENGTH (type) <= 2 * MIPS64_REGSIZE
SAFE: (mips-tdep.c:5041): ASSIGN: (ULONGEST to int) [ xfer = (type)->length - offset]
SAFE(non-struct type): (mips-tdep.c:5059): CMP: (ULONGEST to int) [offset < (type)->length]
SAFE(Likewise): (mips-tdep.c:5063): CMP: (ULONGEST to int) [offset + xfer > (type)->length]
SAFE: (mips-tdep.c:5064): ASSIGN: (ULONGEST to int) [ xfer = (type)->length - offset]
SAFE(float type): (mips-tdep.c:5244): FUNC(phex): (LONGEST to int) [len]
SAFE: (mips-tdep.c:5252): FUNC(phex): (LONGEST to int) [len]
SAFE: (mips-tdep.c:5284): VARINIT(partial_len): (LONGEST to int) [(len < MIPS32_REGSIZE ? len : MIPS32_REGSIZE)]
SAFE(Not a struct): (mips-tdep.c:5444): FUNC(mips_xfer_register): (ULONGEST to int) [(type)->length]
SAFE(Likewise): (mips-tdep.c:5450): FUNC(mips_xfer_register): (ULONGEST to int) [(type)->length]
SAFE(Likewise): (mips-tdep.c:5599): CMP: (ULONGEST to int) [offset < (type)->length]
SAFE(Likewise): (mips-tdep.c:5603): CMP: (ULONGEST to int) [offset + xfer > (type)->length]
SAFE(Likewise): (mips-tdep.c:5604): ASSIGN: (ULONGEST to int) [ xfer = (type)->length - offset]
SAFE: (mips-tdep.c:5712): FUNC(store_signed_integer): (CORE_ADDR to LONGEST) [make_compact_addr(addr)]
SAFE(Float type): (mips-tdep.c:5733): FUNC(phex): (LONGEST to int) [len]
SAFE(Likewise): (mips-tdep.c:5737): FUNC(phex): (LONGEST to int) [len]
SAFE: (mips-tdep.c:5758): VARINIT(partial_len): (LONGEST to int) [(len < MIPS64_REGSIZE ? len : MIPS64_REGSIZE)]
SAFE: (mips-tdep.c:5779): ASSIGN: (LONGEST to int) [ longword_offset = MIPS64_REGSIZE - len]
SAFE: (mips-tdep.c:5785): FUNC(paddress): (LONGEST to CORE_ADDR) [stack_offset]
SAFE(Not a struct): (mips-tdep.c:5909): FUNC(mips_xfer_register): (ULONGEST to int) [(type)->length]
SAFE(Likewise): (mips-tdep.c:5915): FUNC(mips_xfer_register): (ULONGEST to int) [(type)->length]
SAFE(Likewise): (mips-tdep.c:5927): CMP: (ULONGEST to int) [offset < (type)->length]
SAFE(Likewise): (mips-tdep.c:5931): CMP: (ULONGEST to int) [offset + xfer > (type)->length]
SAFE(Likewise): (mips-tdep.c:5932): ASSIGN: (ULONGEST to int) [ xfer = (type)->length - offset]
FIXED(Expand len): (mn10300-tdep.c:174): VARINIT(len): (ULONGEST to int) [(type)->length]
FIXED(Likewise): (mn10300-tdep.c:203): VARINIT(len): (ULONGEST to int) [(type)->length]
SAFE: (mt-tdep.c:353): FUNC(read_memory): (ULONGEST to ssize_t) [(type)->length]
SAFE: (mt-tdep.c:361): FUNC(write_memory): (ULONGEST to ssize_t) [(type)->length]
SAFE: (mt-tdep.c:386): FUNC(memcpy): (ULONGEST to size_t) [(type)->length]
SAFE(stack_dest should be CORE_ADDR, but safe for now): (mt-tdep.c:786): VARINIT(stack_dest): (CORE_ADDR to LONGEST) [sp]
- There should be checked overflow of sp - length in general in these
*_push_dummy_call functions but passing >2GB structs by value on stack is
probably not worth fixing.
But I do not see why you did not choose CORE_ADDR for stack_dest here.
SAFE: (mt-tdep.c:827): ASSIGN: (LONGEST to int) [ split_param_len = typelen]
SAFE: (mt-tdep.c:828): FUNC(memcpy): (LONGEST to size_t) [typelen]
SAFE: (mt-tdep.c:838): FUNC(write_memory): (LONGEST to CORE_ADDR) [stack_dest]
SAFE: (mt-tdep.c:838): FUNC(write_memory): (LONGEST to ssize_t) [typelen]
SAFE: (mt-tdep.c:851): ASSIGN: (LONGEST to int) [ slacklen = (4 - (typelen % 4)) % 4]
UNSAFE_ALLOCA: (mt-tdep.c:852): FUNC(C_alloca): (LONGEST to size_t) [typelen + slacklen]
- Just drop alloca, two write_memory calls are enough.
UNSAFE_ALLOCA: (mt-tdep.c:853): FUNC(memcpy): (LONGEST to size_t) [typelen]
- Just drop alloca, two write_memory calls are enough.
SAFE: (mt-tdep.c:857): FUNC(write_memory): (LONGEST to CORE_ADDR) [stack_dest]
SAFE: (mt-tdep.c:857): FUNC(write_memory): (LONGEST to ssize_t) [typelen + slacklen]
SAFE: (mt-tdep.c:865): FUNC(write_memory): (LONGEST to CORE_ADDR) [stack_dest]
SAFE: (mt-tdep.c:882): RET: (LONGEST to CORE_ADDR) [stack_dest]
FIXED(Expand i): (objc-lang.c:371): CMP: (ULONGEST to UINT) [i < length]
FIXED(Expand rep1): (objc-lang.c:389): CMP: (ULONGEST to UINT) [rep1 < length]
FIXED: (objc-lang.c:435): CMP: (ULONGEST to UINT) [i < length]
SAFE: (opencl-lang.c:196): FUNC(memcpy): (LONGEST to size_t) [elsize]
SAFE: (opencl-lang.c:236): FUNC(memcpy): (LONGEST to size_t) [elsize]
FIXED(Expand startrest): (opencl-lang.c:253): VARINIT(startrest): (LONGEST to int) [offset % elsize]
- 'elsize' line is longer than 80 columns. One should check the whole patch.
(In these cases a new helper variable makes it easier to conform to the GNU indentation style.)
FIXED(Expand endrest, comp_offset, comp_length): (opencl-lang.c:255): VARINIT(endrest): (LONGEST to int) [(offset + length) % elsize]
FIXED: (opencl-lang.c:268): COND: (LONGEST to int) []
FIXED: (opencl-lang.c:307): VARINIT(startrest): (LONGEST to int) [offset % elsize]
FIXED: (opencl-lang.c:309): VARINIT(endrest): (LONGEST to int) [(offset + length) % elsize]
FIXED: (opencl-lang.c:322): COND: (LONGEST to int) []
SAFE: (opencl-lang.c:428): FUNC(memcpy): (ULONGEST to size_t) [(elm_type)->length]
- I miss here FIX of: opencl-lang.c:450
int src_len; LONGEST lowb, highb; src_len = highb - lowb + 1;
It will affect also at least create_value().
SAFE: (opencl-lang.c:581): FUNC(memset): (ULONGEST to size_t) [(eltype)->length]
SAFE: (opencl-lang.c:681): FUNC(memset): (ULONGEST to size_t) [(eltype1)->length]
- I miss here opencl-lang.c:895 where variable "i" should have been expanded.
int i; LONGEST lowb1, highb1; for (i = 0; i < highb1 - lowb1 + 1; i++)
SAFE: (opencl-lang.c:901): FUNC(memcpy): (ULONGEST to size_t) [(eltype2)->length]
SAFE: (p-lang.c:233): ASSIGN: (ULONGEST to int) [ width = (type)->length]
FIXED(Expand i): (p-lang.c:249): CMP: (ULONGEST to UINT) [i < length]
FIXED(Expand rep1): (p-lang.c:271): CMP: (ULONGEST to UINT) [rep1 < length]
FIXED: (p-lang.c:319): CMP: (ULONGEST to UINT) [i < length]
WPREVERTED(Only ok_for_watchpoint needs LONGEST len): (ppc-linux-nat.c:2030): FUNC(calculate_dvc): (LONGEST to int) [len]
SAFE: (ppc-linux-nat.c:2053): ASSIGN: (LONGEST to uint64_t) [ p->addr2 = (uint64_t)addr + len]
SAFE: (ppc-linux-nat.c:2057): ASSIGN: (int to uint32_t) [ p->trigger_type = get_trigger_type(rw)]
SAFE: (ppc-sysv-tdep.c:162): FUNC(align_up): (LONGEST to int) [len]
- I would say at ppc-sysv-tdep.c:124 'len' it should be int->ssize_t instead of int->LONGEST
as there is already value_contents making the checks somehow easier.
SAFE: (ppc-sysv-tdep.c:164): FUNC(write_memory): (LONGEST to ssize_t) [len]
SAFE: (ppc-sysv-tdep.c:193): FUNC(write_memory): (LONGEST to ssize_t) [len]
SAFE: (ppc-sysv-tdep.c:215): FUNC(write_memory): (LONGEST to ssize_t) [len]
SAFE: (ppc-sysv-tdep.c:250): FUNC(write_memory): (LONGEST to ssize_t) [len]
SAFE: (ppc-sysv-tdep.c:304): FUNC(align_up): (LONGEST to int) [len]
SAFE: (ppc-sysv-tdep.c:308): FUNC(write_memory): (LONGEST to ssize_t) [len]
SAFE: (ppc-sysv-tdep.c:380): FUNC(align_up): (LONGEST to int) [len]
SAFE: (ppc-sysv-tdep.c:382): FUNC(write_memory): (LONGEST to ssize_t) [len]
SAFE: (ppc-sysv-tdep.c:395): FUNC(write_memory): (ULONGEST to ssize_t) [(eltype)->length]
SAFE(Vectors may not be larger than int): (ppc-sysv-tdep.c:447): CMP: (LONGEST to int) [i < len / 16]
- This is dependency on external producer (gcc).
GDB should verify it, such as ENSURE_SIZET or a proper handling.
External producer could incorrectly mark DW_AT_GNU_vector some large type
and GDB would process it incorrectly.
SAFE: (ppc-sysv-tdep.c:537): FUNC(write_memory): (LONGEST to ssize_t) [len]
SAFE: (ppc-sysv-tdep.c:550): FUNC(memcpy): (LONGEST to size_t) [len]
FIXED(Expand argspace): (ppc-sysv-tdep.c:574): ASSIGN: (LONGEST to int) [ argspace = argoffset]
SAFE: (ppc-sysv-tdep.c:814): CMP: (int to ULONGEST) [(type)->length <= tdep->wordsize]
REVERTED(vectors < 16 bytes): (ppc-sysv-tdep.c:852): VARINIT(regnum): (LONGEST to int) [tdep->ppc_fp0_regnum + 1 + i]
- it still could REVERT ppc-sysv-tdep.c:844 and ppc-sysv-tdep.c:848.
REVERTED: (ppc-sysv-tdep.c:871): VARINIT(regnum): (LONGEST to int) [tdep->ppc_gp0_regnum + 3 + i]
SAFE(int sufficient for OpenCL vectors): (ppc-sysv-tdep.c:897): VARINIT(n_regs): (ULONGEST to int) [(type)->length / 16]
- While true again it is dependency on external producer (gcc).
SAFE: (ppc-sysv-tdep.c:984): VARINIT(len): (ULONGEST to int) [(type)->length]
SAFE: (ppc-sysv-tdep.c:1019): CMP: (int to ULONGEST) [(type)->length > tdep->wordsize]
SAFE: (ppc-sysv-tdep.c:1022): FUNC(memcpy): (ULONGEST to size_t) [(type)->length]
SAFE: (ppc-sysv-tdep.c:1031): FUNC(memcpy): (ULONGEST to size_t) [(type)->length]
SAFE: (ppc-sysv-tdep.c:1034): CMP: (int to ULONGEST) [(type)->length > tdep->wordsize]
SAFE: (ppc-sysv-tdep.c:1304): FUNC(write_memory): (ULONGEST to ssize_t) [(type)->length]
SAFE: (ppc-sysv-tdep.c:1360): FUNC(write_memory): (ULONGEST to ssize_t) [(type)->length]
SAFE(OpenCL Vector): (ppc-sysv-tdep.c:1375): VARINIT(nelt): (ULONGEST to int) [(type)->length / (eltype)->length]
SAFE(OpenCL Vector): (ppc-sysv-tdep.c:1448): CMP: (ULONGEST to int) [i < (type)->length / 16]
- While true again it is dependency on external producer (gcc).
SAFE: (ppc-sysv-tdep.c:1487): FUNC(write_memory): (ULONGEST to ssize_t) [(type)->length]
SAFE(OpenCL Vector): (ppc-sysv-tdep.c:1502): FUNC(write_memory): (ULONGEST to ssize_t) [(type)->length]
FIXED(Expand byte): (ppc-sysv-tdep.c:1561): CMP: (ULONGEST to int) [byte < (type)->length]
- OK although ssize_t would be enough here.
FIXED(Expand len): (ppc-sysv-tdep.c:1567): VARINIT(len): (ULONGEST to int) [(type)->length - byte]
- OK although ssize_t would be enough here.
SAFE: (ppc-sysv-tdep.c:1597): FUNC(write_memory): (LONGEST to ssize_t) [len]
- OK although ssize_t would be enough here.
SAFE: (ppc-sysv-tdep.c:1599): FUNC(write_memory): (LONGEST to ssize_t) [len]
SAFE: (ppc-sysv-tdep.c:1792): VARINIT(nelt): (ULONGEST to int) [(valtype)->length / (eltype)->length]
SAFE: (ppc-sysv-tdep.c:1796): VARINIT(offset): (ULONGEST to int) [i * (eltype)->length]
REVERTED(OpenCL vectors don't need LONGEST): (ppc-sysv-tdep.c:1851): VARINIT(regnum): (LONGEST to int) [tdep->ppc_vr0_regnum + 2 + i]
SAFE: (ppc-sysv-tdep.c:1869): VARINIT(offset): (ULONGEST to int) [(register_size(gdbarch, tdep->ppc_gp0_regnum + 3) - (valtype)->length)]
SAFE: (ppc-sysv-tdep.c:1873): FUNC(regcache_cooked_write_part): (ULONGEST to int) [(valtype)->length]
SAFE: (ppc-sysv-tdep.c:1876): FUNC(regcache_cooked_read_part): (ULONGEST to int) [(valtype)->length]
SAFE: (ppc-sysv-tdep.c:1900): CMP: (ULONGEST to int) [i < (valtype)->length / 8]
SAFE: (printcmd.c:378): CMP: (size_t to ULONGEST) [len > sizeof(LONGEST)]
SAFE: (printcmd.c:385): FUNC(print_octal_chars): (ULONGEST to UINT) [len]
SAFE: (printcmd.c:389): FUNC(print_decimal_chars): (ULONGEST to UINT) [len]
SAFE: (printcmd.c:392): FUNC(print_binary_chars): (ULONGEST to UINT) [len]
SAFE: (printcmd.c:398): FUNC(print_char_chars): (ULONGEST to UINT) [len]
SAFE: (printcmd.c:419): CMP: (size_t to ULONGEST) [len < sizeof(LONGEST)]
SAFE: (printcmd.c:2117): VARINIT(wcwidth): (ULONGEST to int) [(wctype)->length]
SAFE: (printcmd.c:2176): FUNC(convert_between_encodings): (ULONGEST to UINT) [(valtype)->length]
SAFE: (printcmd.c:2177): FUNC(convert_between_encodings): (ULONGEST to int) [(valtype)->length]
SAFE: (printcmd.c:2269): VARINIT(param_len): (ULONGEST to UINT) [(param_type)->length]
- While it is technically right I would expand it here, at the point where it
is computed it is still not clear the type is TYPE_CODE_DECFLOAT.
SAFE: (p-valprint.c:212): FUNC(xmalloc): (LONGEST to size_t) [length_size]
- Missing ENSURED_SIZET. Normally it cannot happen but broken compiler can
produce arbitrarily long length-of-string field which this way could be
incorrectly processed by GDB without an error.
- extract_unsigned_integer may also need similar handling as size_t may be > int.
SAFE: (p-valprint.c:213): FUNC(read_memory): (LONGEST to ssize_t) [length_size]
SAFE: (p-valprint.c:323): ASSIGN: (ULONGEST to UINT) [ len = extract_unsigned_integer(valaddr + embedded_offset + length_pos, length_size, byte_order)]
- Again, like above.
ENSURED_SIZET: (p-valprint.c:804): FUNC(xmalloc): (ULONGEST to size_t) [(baseclass)->length]
ENSURED_SIZET: (p-valprint.c:809): FUNC(target_read_memory): (ULONGEST to ssize_t) [(baseclass)->length]
FIXED(Use PyLong_FromLongLong): (python/py-type.c:179): FUNC(PyLong_FromLong): (LONGEST to LONG) [((((type)->main_type->flds_bnds.fields[field]).loc.bitpos) + 0)]
- This is not correct but it has been correctly checked in in the meantime.
[PATCH 3/3] bitpos: Minor python changes for bitpos expansion
http://sourceware.org/ml/gdb-patches/2012-08/msg00146.html
FIXED(Likewise): (python/py-type.c:686): FUNC(PyLong_FromLong): (ULONGEST to LONG) [(type)->length]
- Likewise.
SAFE: (python/py-value.c:983): FUNC(decimal_is_zero): (ULONGEST to int) [(type)->length]
SAFE: (regcache.c:128): ASSIGN: (ULONGEST to LONG) [ descr->sizeof_register[i] = (descr->register_type[i])->length]
SAFE: (regcache.c:138): ASSIGN: (ULONGEST to LONG) [ descr->sizeof_register[i] = (descr->register_type[i])->length]
SAFE: (remote.c:8051): FUNC(xsnprintf): (int to size_t) [endbuf - p]
SAFE: (remote.c:8095): FUNC(xsnprintf): (int to size_t) [endbuf - p]
WPREVERT(Only ok_for_watchpoint needs LONGEST): (remote-m32r-sdi.c:1434): ASSIGN: (LONGEST to UINT) [ ab_size[i] = len]
WPREVERT(Likewise): (remote-mips.c:2458): FUNC(mips_common_breakpoint): (LONGEST to int) [len]
WPREVERT(Likewise): (remote-mips.c:2467): FUNC(mips_common_breakpoint): (LONGEST to int) [len]
SAFE: (rl78-tdep.c:1027): FUNC(write_memory): (LONGEST to ssize_t) [len]
SAFE: (rs6000-aix-tdep.c:277): CMP: (LONGEST to int) [argbytes < len]
SAFE: (rs6000-aix-tdep.c:280): FUNC(memset): (int to size_t) [reg_size]
SAFE: (rs6000-aix-tdep.c:299): VARINIT(adj): (LONGEST to int) [gdbarch_byte_order(gdbarch) == BFD_ENDIAN_BIG ? reg_size - len : 0]
SAFE: (rs6000-aix-tdep.c:304): FUNC(memcpy): (LONGEST to size_t) [len]
SAFE: (rs6000-aix-tdep.c:366): FUNC(write_memory): (LONGEST to ssize_t) [len - argbytes]
SAFE: (rs6000-aix-tdep.c:393): FUNC(write_memory): (LONGEST to ssize_t) [len]
SAFE: (rs6000-aix-tdep.c:494): CMP: (int to ULONGEST) [(valtype)->length <= tdep->wordsize]
SAFE(Not struct): (rx-tdep.c:640): ASSIGN: (ULONGEST to int) [ p_arg_size = (p_arg_type)->length]
SAFE: (s390-tdep.c:2495): FUNC(is_power_of_two): (ULONGEST to UINT) [(type)->length]
FIXED(Expand n): (s390-tdep.c:2516): VARINIT(length): (ULONGEST to UINT) [(type)->length]
- I do not see 'n' anywhere, you have modified s390_function_arg_float
(s390-tdep.c:2505) but s390_function_arg_integer (s390-tdep.c:2516)
also should be / is not expanded.
SAFE: (s390-tdep.c:2555): ASSIGN: (ULONGEST to int) [ alignment = (type)->length]
SAFE: (s390-tdep.c:2675): FUNC(write_memory): (ULONGEST to ssize_t) [length]
SAFE: (s390-tdep.c:2699): FUNC(regcache_cooked_write_part): (ULONGEST to int) [length]
SAFE: (s390-tdep.c:2707): FUNC(write_memory): (ULONGEST to ssize_t) [length]
SAFE: (s390-tdep.c:2710): CMP: (int to ULONGEST) [length <= word_size]
SAFE: (s390-tdep.c:2728): CMP: (int to ULONGEST) [length == 2 * word_size]
SAFE: (s390-tdep.c:2744): FUNC(write_memory): (ULONGEST to ssize_t) [length]
SAFE: (s390-tdep.c:2840): FUNC(regcache_cooked_write_part): (LONGEST to int) [length]
SAFE: (s390-tdep.c:2877): FUNC(regcache_cooked_read_part): (LONGEST to int) [length]
SAFE: (s390-tdep.c:2883): FUNC(regcache_cooked_read_part): (LONGEST to int) [length]
SAFE(Not struct): (score-tdep.c:465): CMP: (ULONGEST to int) [offset < (type)->length]
SAFE: (score-tdep.c:470): CMP: (ULONGEST to int) [offset + xfer > (type)->length]
SAFE: (score-tdep.c:471): ASSIGN: (ULONGEST to int) [ xfer = (type)->length - offset]
SAFE: (score-tdep.c:592): VARINIT(partial_len): (LONGEST to int) [arglen < 4 ? arglen : 4]
SAFE: (sh64-tdep.c:1116): FUNC(memcpy): (LONGEST to size_t) [len]
SAFE: (sh64-tdep.c:1118): FUNC(memcpy): (LONGEST to size_t) [len]
SAFE: (sh64-tdep.c:1269): ASSIGN: (LONGEST to int) [ offset = register_size(gdbarch, DEFAULT_RETURN_REGNUM) - len]
SAFE: (sh64-tdep.c:1273): FUNC(memcpy): (LONGEST to size_t) [len]
SAFE: (sh64-tdep.c:1298): CMP: (LONGEST to int) [i < len]
SAFE: (sh64-tdep.c:1318): ASSIGN: (LONGEST to int) [ offset = register_size(gdbarch, return_register) - len]
SAFE: (sh64-tdep.c:1320): FUNC(memcpy): (LONGEST to size_t) [len]
FIXED(Expand len): (sh-tdep.c:808): VARINIT(len): (ULONGEST to int) [(type)->length]
FIXED: (sh-tdep.c:828): CMP: (int to ULONGEST) [((((type)->main_type->flds_bnds.fields[0]).type))->length == len]
FIXED(Expand len, sh_justify_value_in_reg arg): (sh-tdep.c:1097): ASSIGN: (ULONGEST to int) [ len = (type)->length]
- Excessive ensure_type_fits_sizet in your patch at sh-tdep.c:1129
because there is sh_justify_value_in_reg above it.
SAFE: (sh-tdep.c:1146): CMP: (int to ULONGEST) [(type)->length == 2 * reg_size]
FIXED(Expand len, sh_justify_value_in_reg arg): (sh-tdep.c:1234): ASSIGN: (ULONGEST to int) [ len = (type)->length]
- Excessive ensure_type_fits_sizet in your patch at sh-tdep.c:1258
because there is sh_justify_value_in_reg above it.
SAFE: (sh-tdep.c:1321): CMP: (LONGEST to int) [i < len]
SAFE(Float type): (sh-tdep.c:1335): VARINIT(len): (ULONGEST to int) [(type)->length]
FIXED(Expand i): (sh-tdep.c:1371): CMP: (LONGEST to int) [i < len]
SAFE(Floaty type): (sh-tdep.c:1383): VARINIT(len): (ULONGEST to int) [(type)->length]
SAFE: (solib-darwin.c:140): ASSIGN: (ULONGEST to int) [ len = 4 + 4 + 2 * ptr_type->length]
SAFE: (solib-darwin.c:250): VARINIT(ptr_len): (ULONGEST to int) [(ptr_type)->length]
SAFE: (solib-svr4.c:714): VARINIT(pbuf_size): (ULONGEST to int) [(ptr_type)->length]
SAFE: (solib-svr4.c:893): VARINIT(l_name_size): (ULONGEST to int) [(ptr_type)->length]
SAFE: (sparc64-tdep.c:67): VARINIT(len): (ULONGEST to int) [(type)->length]
SAFE: (sparc64-tdep.c:74): VARINIT(len): (ULONGEST to int) [(type)->length]
SAFE: (sparc64-tdep.c:94): VARINIT(len): (ULONGEST to int) [(type)->length]
SAFE: (sparc64-tdep.c:114): VARINIT(len): (ULONGEST to int) [(type)->length]
SAFE(Used only for floating types): (sparc64-tdep.c:645): VARINIT(len): (ULONGEST to int) [(type)->length]
SAFE: (sparc64-tdep.c:666): ASSIGN: (LONGEST to int) [ regnum = SPARC64_D0_REGNUM + element + bitpos / 64]
SAFE: (sparc64-tdep.c:674): ASSIGN: (LONGEST to int) [ regnum = SPARC_F0_REGNUM + element * 2 + bitpos / 32]
SAFE(Float type): (sparc64-tdep.c:721): VARINIT(len): (ULONGEST to int) [(type)->length]
SAFE: (sparc64-tdep.c:728): ASSIGN: (LONGEST to int) [ regnum = SPARC64_Q0_REGNUM + bitpos / 128]
SAFE: (sparc64-tdep.c:735): ASSIGN: (LONGEST to int) [ regnum = SPARC64_D0_REGNUM + bitpos / 64]
SAFE: (sparc64-tdep.c:743): ASSIGN: (LONGEST to int) [ regnum = SPARC_F0_REGNUM + bitpos / 32]
SAFE: (sparc64-tdep.c:816): FUNC(write_memory): (LONGEST to ssize_t) [len]
FIXED(Expand len): (sparc64-tdep.c:887): VARINIT(len): (ULONGEST to int) [(type)->length]
FIXED(Expand len): (sparc64-tdep.c:1024): VARINIT(len): (ULONGEST to int) [(type)->length]
FIXED(Expand len): (sparc64-tdep.c:1074): VARINIT(len): (ULONGEST to int) [(type)->length]
SAFE: (sparc-tdep.c:181): VARINIT(len): (ULONGEST to int) [(type)->length]
SAFE: (sparc-tdep.c:214): VARINIT(len): (ULONGEST to int) [(type)->length]
SAFE: (sparc-tdep.c:233): VARINIT(len): (ULONGEST to int) [(type)->length]
SAFE: (sparc-tdep.c:486): FUNC(write_memory): (LONGEST to ssize_t) [len]
SAFE: (sparc-tdep.c:524): VARINIT(len): (ULONGEST to int) [(type)->length]
SAFE(Not struct): (sparc-tdep.c:1254): VARINIT(len): (ULONGEST to int) [(type)->length]
SAFE(Not struct): (sparc-tdep.c:1308): VARINIT(len): (ULONGEST to int) [(type)->length]
SAFE: (sparc-tdep.c:1379): FUNC(read_memory): (ULONGEST to ssize_t) [(type)->length]
SAFE: (spu-tdep.c:323): VARINIT(preferred_slot): (LONGEST to int) [len < 4 ? 4 - len : 0]
FIXED(Expand len): (spu-tdep.c:1296): VARINIT(len): (ULONGEST to int) [(type)->length]
- This is not needed, it has to fit in inferior registers.
FIXED(Likewise): (spu-tdep.c:1321): VARINIT(len): (ULONGEST to int) [(type)->length]
- Likewise.
FIXED(Eliminate len and expand n_regs): (spu-tdep.c:1376): VARINIT(len): (ULONGEST to int) [(type)->length]
FIXED(Expand len): (spu-tdep.c:1409): VARINIT(len): (ULONGEST to int) [(type)->length]
SAFE: (spu-tdep.c:1475): CMP: (int to ULONGEST) [(type)->length <= (SPU_ARGN_REGNUM - SPU_ARG1_REGNUM + 1) * 16]
SAFE: (stabsread.c:785): ASSIGN: (ULONGEST to LONG) [ ((&objfile->objfile_obstack))->temp = (((dbl_type)->length))]
SAFE: (stabsread.c:1069): CMP: (int to ULONGEST) [((sym)->type)->length < gdbarch_int_bit(gdbarch) / 8]
SAFE: (stabsread.c:2961): CMP: (ULONGEST to UINT) [((fip->list->field).bitsize) == 8 * (field_type)->length]
FIXED(Expand highest_offset, start, print_frame_nameless_args arg 2): (stack.c:548): ASSIGN: (LONGEST to LONG) [ highest_offset = current_offset]
- current_offset/highest_offset could be split out, it is a different bug.
But fine with merged it here.
SAFE: (stap-probe.c:1215): FUNC(target_read_memory): (ULONGEST to ssize_t) [(type)->length]
SAFE: (stap-probe.c:1233): FUNC(target_write_memory): (ULONGEST to ssize_t) [(type)->length]
SAFE(Not struct): (tic6x-tdep.c:746): VARINIT(len): (ULONGEST to int) [(valtype)->length]
SAFE(likewise): (tic6x-tdep.c:791): VARINIT(len): (ULONGEST to int) [(valtype)->length]
SAFE(len <= 8): (tic6x-tdep.c:866): VARINIT(len): (ULONGEST to int) [(check_typedef(type))->length]
FIXED(Expand len): (tic6x-tdep.c:974): VARINIT(len): (ULONGEST to int) [(arg_type)->length]
- references_offset is incorrectly not expanded.
SAFE: (tilegx-tdep.c:210): CMP: (int to ULONGEST) [(type)->length > (1 + TILEGX_R9_REGNUM - TILEGX_R0_REGNUM) * tilegx_reg_size]
FIXED(Expand len, i): (tilegx-tdep.c:221): VARINIT(len): (ULONGEST to int) [(type)->length]
- not needed, it is used only if !tilegx_use_struct_convention
SAFE: (tilegx-tdep.c:241): FUNC(memcpy): (ULONGEST to size_t) [(type)->length]
FIXED(Expand len, i): (tilegx-tdep.c:246): VARINIT(len): (ULONGEST to int) [(type)->length]
- not needed, it is used only if !tilegx_use_struct_convention
FIXED(Expand typelen): (tilegx-tdep.c:308): ASSIGN: (ULONGEST to int) [ typelen = (value_enclosing_type(args[i]))->length]
- For example stacklen and alignlen are incorrectly not expanded.
FIXED: (tilegx-tdep.c:334): ASSIGN: (ULONGEST to int) [ typelen = (value_enclosing_type(args[j]))->length]
UNSAFE_ALLOCA: (tilegx-tdep.c:347): ASSIGN: (ULONGEST to int) [ typelen = (value_enclosing_type(args[j]))->length]
- Please fix as an unrelated patch; it should be also ENSURED properly.
FIXED(Expand memrange last arg): (tracepoint.c:1005): FUNC(add_memrange): (ULONGEST to ULONG) [len]
SAFE: (tracepoint.c:1016): CMP: (int to ULONGEST) [len > register_size(gdbarch, reg)]
FIXED: (tracepoint.c:1034): FUNC(add_memrange): (ULONGEST to ULONG) [len]
SAFE: (tracepoint.c:1037): ASSIGN: (LONGEST to UINT) [ reg = (sym)->ginfo.value.ivalue]
FIXED: (tracepoint.c:1046): FUNC(add_memrange): (ULONGEST to ULONG) [len]
SAFE: (tracepoint.c:1049): ASSIGN: (LONG to UINT) [ reg = frame_regno]
FIXED: (tracepoint.c:1058): FUNC(add_memrange): (ULONGEST to ULONG) [len]
SAFE: (tracepoint.c:1485): FUNC(add_memrange): (CORE_ADDR to bfd_signed_vma) [addr]
FIXED: (tracepoint.c:1485): FUNC(add_memrange): (ULONGEST to ULONG) [len]
- Expansion of 'addr' is correct but unrelated.
FIXED(Expand len): (v850-tdep.c:851): ASSIGN: (ULONGEST to int) [ len = (value_type(*args))->length]
- Not needed to expand v850-tdep.c:893 due to !v850_use_struct_convention by its caller.
- Not needed to expand v850-tdep.c:920 due to !v850_use_struct_convention by its caller.
SAFE: (v850-tdep.c:929): CMP: (LONGEST to int) [i < len]
SAFE(string/char types): (valarith.c:713): ASSIGN: (ULONGEST to int) [ inval2len = (type2)->length]
SAFE: (valarith.c:757): ASSIGN: (ULONGEST to int) [ inval1len = (type1)->length]
- TYPE_CODE_STRING can be also >2GB, it is in fact a sort of array.
For example Fortran uses these.
Also it needs alloca expansion.
SAFE: (valarith.c:758): ASSIGN: (ULONGEST to int) [ inval2len = (type2)->length]
- Likewise.
SAFE: (valarith.c:895): ASSIGN: (ULONGEST to int) [ *len_x = (type1)->length]
SAFE: (valarith.c:901): ASSIGN: (ULONGEST to int) [ *len_x = (type2)->length]
SAFE: (valarith.c:914): ASSIGN: (ULONGEST to int) [ *len_y = (type2)->length]
SAFE: (valarith.c:920): ASSIGN: (ULONGEST to int) [ *len_y = (type1)->length]
SAFE: (valarith.c:973): ASSIGN: (ULONGEST to int) [ len_v = (result_type)->length]
SAFE(Vector types): (valarith.c:1414): ASSIGN: (ULONGEST to int) [ elsize = (eltype1)->length]
SAFE(likewise): (valarith.c:1417): CMP: (ULONGEST to int) [elsize != (eltype2)->length]
SAFE: (valarith.c:1487): FUNC(decimal_is_zero): (ULONGEST to int) [(type1)->length]
FIXED(Expand len, i): (valarith.c:1512): VARINIT(len): (LONGEST to int) [len1 < len2 ? len1 : len2]
SAFE: (valarith.c:1628): FUNC(memcmp): (ULONGEST to size_t) [(type1)->length]
SAFE: (valarith.c:1718): FUNC(memcpy): (ULONGEST to size_t) [(type)->length]
SAFE: (valarith.c:1739): VARINIT(len): (ULONGEST to int) [(type)->length]
SAFE: (valarith.c:1772): FUNC(memcpy): (ULONGEST to size_t) [(eltype)->length]
SAFE: (valarith.c:1809): FUNC(memcpy): (ULONGEST to size_t) [(eltype)->length]
SAFE: (valops.c:474): VARINIT(dec_len): (ULONGEST to int) [(type)->length]
SAFE: (valops.c:480): FUNC(decimal_convert): (ULONGEST to int) [(type2)->length]
SAFE: (valops.c:569): FUNC(memcpy): (ULONGEST to size_t) [(eltype)->length]
SAFE: (valops.c:884): FUNC(decimal_from_string): (ULONGEST to int) [(type)->length]
SAFE: (valops.c:910): FUNC(memcpy): (ULONGEST to size_t) [(eltype)->length]
SAFE: (valops.c:1026): FUNC(read_value_memory): (LONGEST to size_t) [length]
SAFE: (valops.c:1284): CMP: (int to ULONGEST) [(type)->length <= (int)sizeof(LONGEST)]
SAFE: (valops.c:1293): FUNC(read_memory): (LONGEST to ssize_t) [changed_len]
SAFE: (valops.c:1305): FUNC(write_memory_with_notification): (LONGEST to ssize_t) [changed_len]
SAFE: (valops.c:1352): FUNC(get_frame_register_bytes): (LONGEST to CORE_ADDR) [offset]
SAFE: (valops.c:1366): FUNC(put_frame_register_bytes): (LONGEST to CORE_ADDR) [offset]
SAFE: (valops.c:1372): FUNC(put_frame_register_bytes): (LONGEST to CORE_ADDR) [value_offset(toval)]
FIXED(Expanded put_frame_register_bytes arg 4): (valops.c:1373): FUNC(put_frame_register_bytes): (ULONGEST to int) [(type)->length]
- I do not see any expansion and I do not see why.
lval_register values can never be too large.
SAFE: (valops.c:1457): FUNC(memcpy): (ULONGEST to size_t) [(type)->length]
SAFE: (valops.c:1491): FUNC(read_value_memory): (ULONGEST to size_t) [(value_enclosing_type(val))->length]
FIXED(Expand value_cstring arg 2, highbound to LONGEST): (valops.c:1849): VARINIT(highbound): (ULONGEST to int) [len / (char_type)->length]
- value_cstring's parameter 'int->LONGEST len' should have been only ssize_t.
It cannot be larger than 'char *ptr' memory.
SAFE: (valops.c:1854): FUNC(memcpy): (int to size_t) [len]
FIXED: (valops.c:1872): VARINIT(highbound): (ULONGEST to int) [len / (char_type)->length]
- Likewise for the 'len' parameter.
SAFE: (valops.c:1877): FUNC(memcpy): (int to size_t) [len]
SAFE: (valops.c:1891): FUNC(memcpy): (ULONGEST to size_t) [(type)->length]
- While TYPE_CODE_BITSTRING is not used in practice I do not see why it should not be expanded(=fixed).
SAFE: (valops.c:2137): FUNC(target_read_memory): (ULONGEST to ssize_t) [(basetype)->length]
FIXED(Expand boffset - update_search_result,search_struct_field,do_search_struct_field): (valops.c:2173): FUNC(update_search_result): (LONGEST to int) [boffset]
ENSURED_SIZET: (valops.c:2291): FUNC(xmalloc): (ULONGEST to size_t) [(baseclass)->length]
ENSURED_SIZET: (valops.c:2296): FUNC(target_read_memory): (ULONGEST to ssize_t) [(baseclass)->length]
SAFE: (valops.c:3858): FUNC(memcpy): (ULONGEST to size_t) [(real_type)->length]
SAFE: (valops.c:3860): FUNC(memcpy): (ULONGEST to size_t) [(real_type)->length]
SAFE: (valops.c:3878): FUNC(memcpy): (ULONGEST to size_t) [(val_real_type)->length]
SAFE: (valops.c:3881): FUNC(memcpy): (ULONGEST to size_t) [(val_real_type)->length]