diff options
| author | gingerBill <bill@gingerbill.org> | 2021-10-22 14:12:48 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-10-22 14:12:48 +0100 |
| commit | ef73a284e3e438a25a4e329d59057cfa8cddf44c (patch) | |
| tree | 5b4e37bf64f4e8bc43b38a66ba46e103864f548a /src/checker.cpp | |
| parent | 28af376d103da1b7820032de0b6d8fc6ca9d6d3a (diff) | |
Fix check_remove_expr_info
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index d3c0080de..ec20d45d6 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -1111,9 +1111,15 @@ void check_set_expr_info(CheckerContext *c, Ast *expr, AddressingMode mode, Type void check_remove_expr_info(CheckerContext *c, Ast *e) { if (c->untyped != nullptr) { map_remove(c->untyped, hash_pointer(e)); + if (map_get(c->untyped, hash_pointer(e)) != nullptr) { + map_remove(c->untyped, hash_pointer(e)); + GB_ASSERT(map_get(c->untyped, hash_pointer(e)) == nullptr); + } } else { + auto *untyped = &c->info->global_untyped; mutex_lock(&c->info->global_untyped_mutex); - map_remove(&c->info->global_untyped, hash_pointer(e)); + map_remove(untyped, hash_pointer(e)); + GB_ASSERT(map_get(untyped, hash_pointer(e)) == nullptr); mutex_unlock(&c->info->global_untyped_mutex); } } @@ -1191,6 +1197,7 @@ void add_type_and_value(CheckerInfo *i, Ast *expr, AddressingMode mode, Type *ty prev_expr = expr; expr->tav.mode = mode; expr->tav.type = type; + if (mode == Addressing_Constant || mode == Addressing_Invalid) { expr->tav.value = value; } else if (mode == Addressing_Value && is_type_typeid(type)) { |