Skip to content

Commit 9ba799a

Browse files
maleadtsimeonschaub
authored andcommitted
Error when compiling invalid AddrSpacePtrs.
1 parent 2beda67 commit 9ba799a

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/cgutils.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -591,16 +591,14 @@ static Type *bitstype_to_llvm(jl_value_t *bt, bool llvmcall = false)
591591
if (bt == (jl_value_t*)jl_float64_type)
592592
return T_float64;
593593
if (jl_is_addrspace_ptr_type(bt)) {
594-
int as = 0;
595-
596-
jl_datatype_t *typ = (jl_datatype_t*)bt;
597-
jl_value_t *as_param = jl_svecref(typ->parameters, 1);
598-
594+
jl_value_t *as_param = jl_tparam1(bt);
595+
int as;
599596
if (jl_is_int32(as_param))
600597
as = jl_unbox_int32(as_param);
601598
else if (jl_is_int64(as_param))
602599
as = jl_unbox_int64(as_param);
603-
600+
else
601+
jl_error("invalid pointer address space");
604602
return PointerType::get(T_int8, as);
605603
}
606604
int nb = jl_datatype_size(bt);

0 commit comments

Comments
 (0)