aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-02-25 20:28:09 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-02-25 20:33:40 -0500
commit7571db05de3efcbc70a8404de6f479909b465eaa (patch)
tree7ed637211a9c29358fc870c16eb9511183797720 /src
parent4b7e285b763046052c154b71a95a0ff05472f41f (diff)
downloadzig-7571db05de3efcbc70a8404de6f479909b465eaa.tar.gz
zig-7571db05de3efcbc70a8404de6f479909b465eaa.zip
fix incorrectly trying to memset at comptime
closes #718
Diffstat (limited to 'src')
-rw-r--r--src/ir.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 73ad54a32d..d59acb7015 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -19451,10 +19451,12 @@ static IrInstruction *ir_analyze_instruction_memset(IrAnalyze *ira, IrInstructio
if (type_is_invalid(casted_count->value.type))
return ira->codegen->invalid_instruction;
+ // TODO test this at comptime with u8 and non-u8 types
if (casted_dest_ptr->value.special == ConstValSpecialStatic &&
casted_byte->value.special == ConstValSpecialStatic &&
casted_count->value.special == ConstValSpecialStatic &&
- casted_dest_ptr->value.data.x_ptr.special != ConstPtrSpecialHardCodedAddr)
+ casted_dest_ptr->value.data.x_ptr.special != ConstPtrSpecialHardCodedAddr &&
+ casted_dest_ptr->value.data.x_ptr.mut != ConstPtrMutRuntimeVar)
{
ConstExprValue *dest_ptr_val = &casted_dest_ptr->value;
@@ -19573,6 +19575,8 @@ static IrInstruction *ir_analyze_instruction_memcpy(IrAnalyze *ira, IrInstructio
if (type_is_invalid(casted_count->value.type))
return ira->codegen->invalid_instruction;
+ // TODO test this at comptime with u8 and non-u8 types
+ // TODO test with dest ptr being a global runtime variable
if (casted_dest_ptr->value.special == ConstValSpecialStatic &&
casted_src_ptr->value.special == ConstValSpecialStatic &&
casted_count->value.special == ConstValSpecialStatic &&