From 9bc9346b6acb96838a6144c9bd96c4370e14b0ec Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 29 Jun 2019 13:22:41 +0800 Subject: HIR Gen - Improved error message with integer overflow --- src/hir/from_ast.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/hir/from_ast.cpp b/src/hir/from_ast.cpp index 3976aa9d..0ce55478 100644 --- a/src/hir/from_ast.cpp +++ b/src/hir/from_ast.cpp @@ -751,8 +751,9 @@ 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 - " << ptr->m_value << " > " << UINT_MAX); + ERROR(ty.span(), E0000, "Array size out of bounds - 0x" << ::std::hex << ptr->m_value << " > 0x" << UINT_MAX); } auto size_val = static_cast( ptr->m_value ); return ::HIR::TypeRef::new_array( mv$(inner), size_val ); -- cgit v1.2.3