Re: Output from linearize and LLVM error

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

 



Hi Luc,

On 27 January 2017 at 20:43, Luc Van Oostenryck
<luc.vanoostenryck@xxxxxxxxx> wrote:
> To get the type of malloc()'s arg and this is done by calling
> pseudo_to_value() with the malloc instruction and the pseudo
> for the size (but no info about this pseudo being malloc()'s arg).
> LLVMConstInt() is then called with the constant value and the type
> is given by calling insn_symbol_type() with the malloc instruction
> but again, it's not possible to get the right type without specifying
> we try to get the type of the first argument of the called function
> and not the type of the result.
>

I think that there is a problem wherever pseudo_to_value() is being
used and the pseudo is an integer constant. Firstly the logic for
determining the size of the constant needs to cover all cases and
secondly depending upon the context the constant may need to be cast
to a pointer. So while the patch you mentioned before tries to solve
this for comparison operations, I think that the solution needs to
cater for all use cases not just those. The handling of arguments is
an example of this.

My suggestion is that pseudo_to_value() for PSEUDO_VAL should always
return an integer constant of type 'long long'  and the caller of
pseudo_to_value() should adjust the constant to right size (by
truncating or extending) or to pointer type if necessary as the caller
has more information. For instance, in the handling of OP_CALL, the
function output_op_call() knows when the call is for an argument, etc.
Currently pseudo_to_value() tries to work out the integer size, but
cannot do this correctly due to lack of information, and also even if
it did work out the size, the cast to pointer would be missed I think.

Does this make sense?

Thanks and 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