aboutsummaryrefslogtreecommitdiff
path: root/src/analyze.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-03-10 01:12:22 -0500
committerAndrew Kelley <superjoe30@gmail.com>2018-03-10 01:38:40 -0500
commit84e952c230ddb9c2bd232958010d2045384532eb (patch)
tree23e153f531fd723e19314320fb87424301d92f21 /src/analyze.cpp
parent3b3649b86f74d08013b669a6a4eac573f8d7fa23 (diff)
downloadzig-84e952c230ddb9c2bd232958010d2045384532eb.tar.gz
zig-84e952c230ddb9c2bd232958010d2045384532eb.zip
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.
Diffstat (limited to 'src/analyze.cpp')
-rw-r--r--src/analyze.cpp8
1 files changed, 5 insertions, 3 deletions
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;
}