Hi Luc, On 2 March 2017 at 16:04, Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> wrote: > However, while running sparse-llvm on some code sample I use to test > the linearization, I see that most errors are type errors and are > related to pointer arithmetic, exactly where LLVM's getelemptr is used. > Most offending instructions are OP_ADD (but since I have tests for > bitfields I see also errors for OP_AND, OP_OR & OP_LSR). > I guess that if you test OP_ADD instruction with pointer on one side > and integer on tne other side and issue an appropriate LLVMBuildGEP(), > things will already be much better. > This seems spot on as by making change as below, the final assertion failure went away. I have not yet checked the generated code but that is next. case OP_ADD: if (symbol_is_fp_type(C, insn->type)) target = LLVMBuildFAdd(fn->builder, lhs, rhs, target_name); else { if (LLVMGetTypeKind(LLVMTypeOf(lhs)) == LLVMPointerTypeKind) { target = LLVMBuildGEP(fn->builder, lhs, &rhs, 1, ""); } else if (LLVMGetTypeKind(LLVMTypeOf(lhs)) == LLVMPointerTypeKind) { target = LLVMBuildGEP(fn->builder, rhs, &lhs, 1, ""); } else { target = LLVMBuildAdd(fn->builder, lhs, rhs, target_name); } } break; Thanks and Regards -- 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