From 6aa04c422bae89c50e1289e1ca51cd4d414debb7 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 25 Aug 2017 20:44:32 -0400 Subject: float division by zero check only when FloatMode.Optimzed closes #395 --- src/codegen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/codegen.cpp') diff --git a/src/codegen.cpp b/src/codegen.cpp index 381500e062..640bece896 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -1269,7 +1269,7 @@ static LLVMValueRef gen_div(CodeGen *g, bool want_debug_safety, bool want_fast_m ZigLLVMSetFastMath(g->builder, want_fast_math); LLVMValueRef zero = LLVMConstNull(type_entry->type_ref); - if (want_debug_safety) { + if (want_debug_safety && (want_fast_math || type_entry->id != TypeTableEntryIdFloat)) { LLVMValueRef is_zero_bit; if (type_entry->id == TypeTableEntryIdInt) { is_zero_bit = LLVMBuildICmp(g->builder, LLVMIntEQ, val2, zero, ""); -- cgit v1.2.3