aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-10-15 01:16:18 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-10-15 01:22:17 -0400
commit9c44dd7db3cfbbdaa082c14ed7fbe1273339a2c6 (patch)
treef3ebb0cb85dce63bb07c867236f04eeee29733b6 /src
parentba405ed59b18871b41aa2fd5288849f725d39531 (diff)
downloadzig-9c44dd7db3cfbbdaa082c14ed7fbe1273339a2c6.tar.gz
zig-9c44dd7db3cfbbdaa082c14ed7fbe1273339a2c6.zip
disable byval parameters on windows to work around llvm bug
See #536
Diffstat (limited to 'src')
-rw-r--r--src/codegen.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 985e390758..1b80ed6b33 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -2272,7 +2272,9 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr
for (size_t param_i = 0; param_i < fn_type_id->param_count; param_i += 1) {
FnGenParamInfo *gen_info = &fn_type->data.fn.gen_param_info[param_i];
- if (gen_info->is_byval) {
+ // Note: byval is disabled on windows due to an LLVM bug:
+ // https://github.com/zig-lang/zig/issues/536
+ if (gen_info->is_byval && g->zig_target.os != ZigLLVM_Win32) {
addLLVMCallsiteAttr(result, (unsigned)gen_info->gen_index, "byval");
}
}
@@ -4023,6 +4025,7 @@ static void generate_enum_name_tables(CodeGen *g) {
TypeTableEntry *u8_ptr_type = get_pointer_to_type(g, g->builtin_types.entry_u8, true);
TypeTableEntry *str_type = get_slice_type(g, u8_ptr_type);
+
for (size_t enum_i = 0; enum_i < g->name_table_enums.length; enum_i += 1) {
TypeTableEntry *enum_tag_type = g->name_table_enums.at(enum_i);
assert(enum_tag_type->id == TypeTableEntryIdEnumTag);
@@ -4257,7 +4260,9 @@ static void do_code_gen(CodeGen *g) {
if (param_type->id == TypeTableEntryIdPointer) {
addLLVMArgAttr(fn_val, (unsigned)gen_index, "nonnull");
}
- if (is_byval) {
+ // Note: byval is disabled on windows due to an LLVM bug:
+ // https://github.com/zig-lang/zig/issues/536
+ if (is_byval && g->zig_target.os != ZigLLVM_Win32) {
addLLVMArgAttr(fn_val, (unsigned)gen_index, "byval");
}
}