diff options
| author | gingerBill <bill@gingerbill.org> | 2021-05-27 09:52:50 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-05-27 09:52:50 +0100 |
| commit | bb7bd94b0ab671513ca2a4e3f9b9973bed87daa6 (patch) | |
| tree | 0d41631046413d706d34be1413017717501ead35 /src | |
| parent | 4a886a1bc5c21b0f06a84c7d063fb7ed8eb2683d (diff) | |
Fix comparison bug of enumerated arrays
Diffstat (limited to 'src')
| -rw-r--r-- | src/llvm_backend.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp index 6ff57aca7..fb7e6441c 100644 --- a/src/llvm_backend.cpp +++ b/src/llvm_backend.cpp @@ -10918,7 +10918,7 @@ lbValue lb_emit_comp(lbProcedure *p, TokenKind op_kind, lbValue left, lbValue ri } } - if (is_type_array(a)) { + if (is_type_array(a) || is_type_enumerated_array(a)) { Type *tl = base_type(a); lbValue lhs = lb_address_from_load_or_generate_local(p, left); lbValue rhs = lb_address_from_load_or_generate_local(p, right); @@ -10935,7 +10935,11 @@ lbValue lb_emit_comp(lbProcedure *p, TokenKind op_kind, lbValue left, lbValue ri } bool inline_array_arith = type_size_of(tl) <= build_context.max_align; - i32 count = cast(i32)tl->Array.count; + i32 count = 0; + switch (tl->kind) { + case Type_Array: count = cast(i32)tl->Array.count; break; + case Type_EnumeratedArray: count = cast(i32)tl->EnumeratedArray.count; break; + } if (inline_array_arith) { // inline |