@@ -1212,7 +1212,9 @@ static LLVMValueRef output_data(LLVMModuleRef module, struct symbol *sym)
break;
}
default:
- assert(0);
+ warning(initializer->pos, "can't initialize type: %s", show_typename(sym));
+ initial_value = NULL;
+ break;
}
} else {
LLVMTypeRef type = symbol_type(sym);
@@ -1220,6 +1222,9 @@ static LLVMValueRef output_data(LLVMModuleRef module, struct symbol *sym)
initial_value = LLVMConstNull(type);
}
+ if (!initial_value)
+ return NULL;
+
name = sym->ident ? show_ident(sym->ident) : "" ;
data = LLVMAddGlobal(module, LLVMTypeOf(initial_value), name);
Currently, sparse-llvm can't emit the needed code for all initializers and when it's the case it stop abruptly with an assert(0). This is kinda useless. Somehow fix this by issuing a warning instead and try to continue gracefully. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- sparse-llvm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)