On Sun, Aug 05, 2012 at 10:47:34PM +0300, Pekka Enberg wrote: > Jonathan Neuschäfer writes: > > compiling a little real-world program with sparse-llvm, it segfaulted. > Using a tool called "delta"[1] and some bash scripting, I managed to > reduce the code to this test case: > > extern struct foo *foop; > extern void func(struct foo *f); > int main(int argc, char **argv) { > func(foop); > } > > The problem is that pseudo_to_value() does not know abou the extern > symbol because Sparse never calls output_data() on it which registers > globals with LLVMAddGlobal(). > > As explained by Linus, 'extern' symbols are just names with types. They > don't have any value associated with them, they just have the type and > the name. Therefore we need to explicitly call LLVMAddGlobal() for > symbols we have not encountered in pseudo_to_value(). > > Reported by: Jonathan Neuschäfer <j.neuschaefer@xxxxxxx> > Cc: Christopher Li <sparse@xxxxxxxxxxx> > Cc: Jeff Garzik <jgarzik@xxxxxxxxxx> > Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> > Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx> This fixes the crash, thanks. Jonathan -- 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