Re: sparse-llvm array size computation issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Luc,

On 28 March 2017 at 22:33, Luc Van Oostenryck
<luc.vanoostenryck@xxxxxxxxx> wrote:
> On Tue, Mar 28, 2017 at 10:14:43PM +0100, Dibyendu Majumdar wrote:
>
>> I think that there is a bug in examine_node_type() in symbol.c - it
>> should set the base_type's bit_size perhaps? See the line marked as
>> FIX below,
>>
>> /* Unsized array? The size might come from the initializer.. */
>> if (bit_size < 0 && base_type->type == SYM_ARRAY) {
>> struct expression *initializer = get_symbol_initializer(sym);
>> if (initializer) {
>> struct symbol *node_type = base_type->ctype.base_type;
>> int count = count_array_initializer(S, node_type, initializer);
>>
>> if (node_type && node_type->bit_size >= 0)
>> bit_size = array_element_offset(S->C->target, node_type->bit_size, count);
>> base_type->bit_size = bit_size;   /*** FIX set base_type->bit_size ***/
>> }
>> }
>
> I'm far from sure.
> Yes, here it will works but in general you have no idea who else is
> using the base_type. For other users it may be legitimally still
> be unsized.
>

I saw that if I set the array size in the C code then
base_type->bit_size gets set. So my reasoning was that this is okay,
as only the way the size is determined is changed, but the array still
has a size. What do you think?

Regards
Dibyendu
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux