All of lore.kernel.org
 help / color / mirror / Atom feed
* Output from linearize and LLVM error
@ 2017-01-27 14:00 Dibyendu Majumdar
  2017-01-27 14:29 ` Dibyendu Majumdar
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Dibyendu Majumdar @ 2017-01-27 14:00 UTC (permalink / raw)
  To: linux-sparse

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?

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?

Thanks and Regards
Dibyendu

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-01-29  9:15 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-27 14:00 Output from linearize and LLVM error Dibyendu Majumdar
2017-01-27 14:29 ` Dibyendu Majumdar
2017-01-27 15:09 ` Dibyendu Majumdar
2017-01-27 15:59 ` Van Oostenryck Luc
2017-01-27 17:11   ` Dibyendu Majumdar
2017-01-27 18:18     ` Dibyendu Majumdar
2017-01-27 19:07       ` Luc Van Oostenryck
2017-01-27 19:22         ` Dibyendu Majumdar
2017-01-27 20:43         ` Luc Van Oostenryck
2017-01-29  0:26           ` Dibyendu Majumdar
2017-01-29  9:15             ` Luc Van Oostenryck
2017-01-27 20:51         ` Luc Van Oostenryck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.