diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-03-07 19:08:02 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-03-07 19:08:02 -0500 |
| commit | ddd9624e2d03b71754e1591637f0f4f835c01a35 (patch) | |
| tree | 6f302c1626c0dd2fbbe7d1452affa555e9d9878c /src/ir.cpp | |
| parent | eb9f1e2d532aa88199fb6afb3e2cfcef43c2ed14 (diff) | |
| download | zig-ddd9624e2d03b71754e1591637f0f4f835c01a35.tar.gz zig-ddd9624e2d03b71754e1591637f0f4f835c01a35.zip | |
fix assertion error, trying to dereference to array
thanks to hoppetosse on IRC for reporting the issue
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
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); } |
