On 3 March 2017 at 19:50, Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> wrote: > On Fri, Mar 3, 2017 at 7:06 PM, Dibyendu Majumdar > <mobile@xxxxxxxxxxxxxxx> wrote: >> The problem occurs in this sequence: >> >> ptrcast.64 %r26 <- (64) %r20 >> add.64 %r27 <- %r26, %r23 >> cast.64 %r28 <- (64) %r27 >> store.64 %r28 -> 16[%arg1] >> >> The last cast finds that the instruction type in an integer and does a >> cast to Integer, so that causes the store to fail as it expects a >> pointer. > > What is the corresponding C code? > With the patches I've posted, the three example you've given are handled > without error for me. > C code below, it is the last += that is failing. 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; if (a->free_list) { a->free_list = (link_t *) (a->free_list->next); return (void *) tmp; } else { if (a->next_avail == a->last) { grow_allocator(a); } { void *tmp; tmp = (void *) a->next_avail; a->next_avail += a->size; 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