aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2020-04-20 18:47:06 +0200
committerAndrew Kelley <andrew@ziglang.org>2020-04-20 13:43:14 -0400
commit5eaf948e6250391b412881aeb702666bfe7d4c42 (patch)
treeb6cbb902c5d1a87b18f4d73caee47ea1c52aa56a /src/codegen.cpp
parent328eb8ed8dfdc646df28f899267c76e18645da40 (diff)
downloadzig-5eaf948e6250391b412881aeb702666bfe7d4c42.tar.gz
zig-5eaf948e6250391b412881aeb702666bfe7d4c42.zip
stage1: Fix wrong union access
Thanks to @frett27 on irc for reporting the compiler would segfault when run on ARM.
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp2
1 files changed, 1 insertions, 1 deletions
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) {