Linearization of arrays & structs default initialization is done as if these objects would be an integer as large as the object. This integer is then simply zero-initialized. (This may be objectionable and will be done differently). However, sparse-llvm is not ready to handle this situation where a non-scalar is initialized with a scalar value. Workaround this by using LLVMConstNull() when possible. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- sparse-llvm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sparse-llvm.c b/sparse-llvm.c index 4c64f1aaa..a1a48fd0f 100644 --- a/sparse-llvm.c +++ b/sparse-llvm.c @@ -354,6 +354,12 @@ static LLVMValueRef constant_value(unsigned long long val, LLVMTypeRef dtype) case LLVMIntegerTypeKind: result = LLVMConstInt(dtype, val, 1); break; + case LLVMArrayTypeKind: + case LLVMStructTypeKind: + if (val != 0) + return NULL; + result = LLVMConstNull(dtype); + break; default: return NULL; } -- 2.15.0 -- 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