Re: Output from linearize and LLVM error

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

 



On Fri, Jan 27, 2017 at 3:00 PM, Dibyendu Majumdar
<mobile@xxxxxxxxxxxxxxx> wrote:
> Hi
> I am investigating some assertion failures I am getting from LLVM when
> trying to compile some test code. Following is a simple test program
> that is failing.
>
> typedef unsigned long long size_t;
> extern void *malloc(size_t);
> struct foo {
>         int i;
> };
> typedef struct foo foo;
> foo*  testfunc(void);
> foo* testfunc(void) {
>         foo *p = (foo *) malloc(sizeof(struct foo));
>         return p;
> }
>
> There were two failures. First one occurs in the result of the
> sizeof() expression - it seems the builder tries to create an integer
> constant but passes LLVM a 'char *' as the type, which causes an
> assertion failure in LLVM. This error occurs in pseudo_to_value()
> function in sparse-llvm.c for the case PSEUDO_VAL. I worked around
> this by checking if the type is a pointer and then asking LLVM to
> create an integer constant of appropriate size (not sure why the type
> is a pointer type here).
>
> Here is the output from test-linearize:
>
> testfunc:
> .L0x7ffae85d1010:
>  <entry-point>
>  call.64     %r1 <- malloc, $4
>  cast.64     %r2 <- (64) %r1
>  ret.64      %r2
>
> The second LLVM assertion failure occurs in the cast to (64).
>
> My question is this - does this cast look correct? Should it not be a
> pointer cast rather than an integer cast?

I think both problems are already addressed but the patches haven't
yet been handled.

You may look at:
- https://patchwork.kernel.org/patch/9469701/
- https://patchwork.kernel.org/patch/9516077/

> Also the output from test-linearize and test-parsing do not seem to
> dump the types. How can I get the types dumped out as well?

Yes, it's sometimes annoying.
Generaly, I when I need this, I add a few printf( .... show_typename(sym))

Regards,
Luc Van Oostenryck
--
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