From 5eaf948e6250391b412881aeb702666bfe7d4c42 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Mon, 20 Apr 2020 18:47:06 +0200 Subject: [PATCH] stage1: Fix wrong union access Thanks to @frett27 on irc for reporting the compiler would segfault when run on ARM. --- src/codegen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/codegen.cpp b/src/codegen.cpp index ea4d698cde..dad8e4768a 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -1887,7 +1887,7 @@ static bool iter_function_params_c_abi(CodeGen *g, ZigType *fn_type, FnWalk *fn_ if (type_is_nonnull_ptr(g, ty)) { addLLVMArgAttr(llvm_fn, fn_walk->data.attrs.gen_i, "nonnull"); } - if (ptr_type->data.pointer.is_const) { + if (ptr_type->id == ZigTypeIdPointer && ptr_type->data.pointer.is_const) { addLLVMArgAttr(llvm_fn, fn_walk->data.attrs.gen_i, "readonly"); } if (param_info->is_noalias) {