Re: Sparse-LLVM issue compiling NULL pointers

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

 



On 3 March 2017 at 02:52, Dibyendu Majumdar <mobile@xxxxxxxxxxxxxxx> wrote:
> Hi Luc,
>
> Next problem:
>
> The following fails.
>
> typedef unsigned long long size_t;
> struct buffer_type_st {
>  struct buffer_type_st    *next_buffer;
>  char           *buffer;
> };
> typedef struct buffer_type_st buffer_type_t;
> struct link_st {
>  struct link_st           *next;
> };
> typedef struct link_st link_t;
> struct allocator_st {
>  buffer_type_t    *buffer_list;
>  link_t           *free_list;
>  char           *next_avail;
>  char           *last;
>  size_t          size;
>  size_t          n;
> };
> typedef struct allocator_st allocator;
> extern void *
> alloc_node(allocator * a);
> extern void
> grow_allocator(allocator * a);
> void *
> alloc_node(allocator * a)
> {
>  link_t           *tmp;
>  tmp = a->free_list;
>  return (void *) tmp;
> }
>
>
> I get LLVM assertion failure for following instruction:
>
> insn cast.64     %r4 <- (64) %r2
>
> Assertion failed: isa<X>(Val) && "cast<Ty>() argument of incompatible
> type!", file C:\d\llvm-3.9.0.src\include\llvm/Support/Casting.h, line
> 237
>
> I think this is because the linearize is outputting an integer cast
> rather than pointer cast so LLVM is not happy.
>

Simpler example:

void *
alloc_node(void)
{
 char *tmp;
 tmp = (void *)0;
 return tmp;
}
--
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