Re: Sparse-LLVM issue compiling NULL pointers

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

 



Hi Luc,

On 28 February 2017 at 15:09, Luc Van Oostenryck
<luc.vanoostenryck@xxxxxxxxx> wrote:
> On Tue, Feb 28, 2017 at 06:20:43AM +0000, Dibyendu Majumdar wrote:
>> I am trying to debug a failure in sparse-llvm when compiling following:
>>
>> struct mytype {
>>  int *foo;
>> };
>> extern void init_mytype(struct mytype *mt);
>> void init_mytype(struct mytype *mt) {
>>  mt->foo = (void *)0;
>> }
>>
>
> I think that the best you can do for us to be able to help you is to create
> test case showing concretely the issues you have.
>

Above is a simple test case. If you use an LLVM build with assertions
enabled then the code generator aborts:

Assertion failed: getOperand(0)->getType() ==
cast<PointerType>(getOperand(1)->getType())->getElementType() && "Ptr
must be a pointer to Val type!", file
C:\d\llvm-3.9.0.src\lib\IR\Instructions.cpp, line 1436

In the details I posted I was trying to say that :

a) The Expression Value does not appear to pass down the fact that it
has found a NULL pointer - i.e. (void *)0.
b) And even if this is conveyed (by making changes I suggested) then
it is lost at the time of converting to value pseudo. As far as I can
tell the cast is not being optimized away, it is just lost in
translation.

I could be wrong in my analysis as I mentioned before. I will try to
generate some debug info to further show what seems to be happening.

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