From 84e952c230ddb9c2bd232958010d2045384532eb Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 10 Mar 2018 01:12:22 -0500 Subject: fix await multithreaded data race coro return was reading from a value that coro await was writing to. that wasn't how it was designed to work, it was an implementation mistake. this commit also has some work-in-progress code for fixing error return traces across suspend points. --- src/analyze.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/analyze.cpp') diff --git a/src/analyze.cpp b/src/analyze.cpp index e40412e863..bb30f53967 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -5856,9 +5856,11 @@ uint32_t get_coro_frame_align_bytes(CodeGen *g) { return g->pointer_size_bytes * 2; } +bool type_can_fail(TypeTableEntry *type_entry) { + return type_entry->id == TypeTableEntryIdErrorUnion || type_entry->id == TypeTableEntryIdErrorSet; +} + bool fn_type_can_fail(FnTypeId *fn_type_id) { - TypeTableEntry *return_type = fn_type_id->return_type; - return return_type->id == TypeTableEntryIdErrorUnion || return_type->id == TypeTableEntryIdErrorSet || - fn_type_id->cc == CallingConventionAsync; + return type_can_fail(fn_type_id->return_type) || fn_type_id->cc == CallingConventionAsync; } -- cgit v1.2.3