From 0a45ac7c93e4e8584fef15b6f2896528a9dbffdd Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 21 Jul 2019 12:15:42 +0800 Subject: HIR - Partial support for large arrays (may fail downstream with overflows) --- src/hir/from_ast.cpp | 4 ++-- src/hir/type.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/hir/from_ast.cpp b/src/hir/from_ast.cpp index 0ce55478..dde40e03 100644 --- a/src/hir/from_ast.cpp +++ b/src/hir/from_ast.cpp @@ -752,8 +752,8 @@ HIR::LifetimeRef LowerHIR_LifetimeRef(const ::AST::LifetimeRef& r) if( ptr->m_datatype == CORETYPE_UINT || ptr->m_datatype == CORETYPE_ANY ) { // TODO: Chage the HIR format to support very large arrays - if( ptr->m_value > UINT_MAX ) { - ERROR(ty.span(), E0000, "Array size out of bounds - 0x" << ::std::hex << ptr->m_value << " > 0x" << UINT_MAX); + if( ptr->m_value >= UINT64_MAX ) { + ERROR(ty.span(), E0000, "Array size out of bounds - 0x" << ::std::hex << ptr->m_value << " > 0x" << UINT64_MAX << " in " << ::std::dec << ty); } auto size_val = static_cast( ptr->m_value ); return ::HIR::TypeRef::new_array( mv$(inner), size_val ); diff --git a/src/hir/type.hpp b/src/hir/type.hpp index 13300bbc..e61c9ec7 100644 --- a/src/hir/type.hpp +++ b/src/hir/type.hpp @@ -220,7 +220,7 @@ public: (Array, struct { ::std::unique_ptr inner; ::std::shared_ptr<::HIR::ExprPtr> size; - size_t size_val; + uint64_t size_val; }), (Slice, struct { ::std::unique_ptr inner; -- cgit v1.2.3