From ddd9624e2d03b71754e1591637f0f4f835c01a35 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 7 Mar 2017 19:08:02 -0500 Subject: fix assertion error, trying to dereference to array thanks to hoppetosse on IRC for reporting the issue --- src/ir.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/ir.cpp') diff --git a/src/ir.cpp b/src/ir.cpp index 425ec733a8..2a8d6fe418 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -9399,7 +9399,12 @@ static TypeTableEntry *ir_analyze_instruction_store_ptr(IrAnalyze *ira, IrInstru if (type_is_invalid(value->value.type)) return value->value.type; - assert(ptr->value.type->id == TypeTableEntryIdPointer); + if (ptr->value.type->id != TypeTableEntryIdPointer) { + ir_add_error(ira, ptr, + buf_sprintf("attempt to dereference non pointer type '%s'", buf_ptr(&ptr->value.type->name))); + return ira->codegen->builtin_types.entry_invalid; + } + if (ptr->value.data.x_ptr.special == ConstPtrSpecialDiscard) { return ir_analyze_void(ira, &store_ptr_instruction->base); } -- cgit v1.2.3