From 968ccfc2409eeb7cdf1debf6e8061bfd2bb470f4 Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Thu, 28 May 2020 14:33:14 +0200 Subject: [PATCH] Error when compiling invalid AddrSpacePtrs. --- src/cgutils.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/cgutils.cpp b/src/cgutils.cpp index d23bf9c20e7e6..57f4b623863ab 100644 --- a/src/cgutils.cpp +++ b/src/cgutils.cpp @@ -591,16 +591,14 @@ static Type *bitstype_to_llvm(jl_value_t *bt, bool llvmcall = false) if (bt == (jl_value_t*)jl_float64_type) return T_float64; if (jl_is_addrspace_ptr_type(bt)) { - int as = 0; - - jl_datatype_t *typ = (jl_datatype_t*)bt; - jl_value_t *as_param = jl_svecref(typ->parameters, 1); - + jl_value_t *as_param = jl_tparam1(bt); + int as; if (jl_is_int32(as_param)) as = jl_unbox_int32(as_param); else if (jl_is_int64(as_param)) as = jl_unbox_int64(as_param); - + else + jl_error("invalid pointer address space"); return PointerType::get(T_int8, as); } int nb = jl_datatype_size(bt);