@@ -2612,14 +2612,13 @@ static bool emit_builtin_call(jl_codectx_t &ctx, jl_cgval_t *ret, jl_value_t *f,
2612
2612
jl_cgval_t ary = emit_expr (ctx, args[1 ]);
2613
2613
ssize_t nd = jl_is_long (ndp) ? jl_unbox_long (ndp) : -1 ;
2614
2614
Value *idx = emit_array_nd_index (ctx, ary, args[1 ], nd, &args[2 ], nargs - 1 );
2615
- if (!isboxed && jl_datatype_size (ety) == 0 ) {
2616
- assert (jl_is_datatype (ety));
2615
+ if (!isboxed && jl_is_datatype (ety) && jl_datatype_size (ety) == 0 ) {
2617
2616
assert (((jl_datatype_t *)ety)->instance != NULL );
2618
2617
*ret = ghostValue (ety);
2619
2618
}
2620
2619
else if (!isboxed && jl_is_uniontype (ety)) {
2621
2620
Value *nbytes = ConstantInt::get (T_size, elsz);
2622
- Value *data = emit_arrayptr (ctx, ary, args[1 ]);
2621
+ Value *data = emit_bitcast (ctx, emit_arrayptr (ctx, ary, args[1 ]), T_pint8 );
2623
2622
// isbits union selector bytes are stored directly after the last array element
2624
2623
Value *selidx = ctx.builder .CreateMul (emit_arraylen_prim (ctx, ary), nbytes);
2625
2624
selidx = ctx.builder .CreateAdd (selidx, idx);
@@ -2668,9 +2667,8 @@ static bool emit_builtin_call(jl_codectx_t &ctx, jl_cgval_t *ret, jl_value_t *f,
2668
2667
ssize_t nd = jl_is_long (ndp) ? jl_unbox_long (ndp) : -1 ;
2669
2668
Value *idx = emit_array_nd_index (ctx, ary, args[1 ], nd, &args[3 ], nargs - 2 );
2670
2669
jl_cgval_t rhs = emit_expr (ctx, args[2 ]);
2671
- if (!isboxed && jl_datatype_size (ety) == 0 ) {
2672
- // no-op, but emit expr for possible effects
2673
- assert (jl_is_datatype (ety));
2670
+ if (!isboxed && jl_is_datatype (ety) && jl_datatype_size (ety) == 0 ) {
2671
+ // no-op
2674
2672
}
2675
2673
else {
2676
2674
PHINode *data_owner = NULL ; // owner object against which the write barrier must check
@@ -2709,7 +2707,7 @@ static bool emit_builtin_call(jl_codectx_t &ctx, jl_cgval_t *ret, jl_value_t *f,
2709
2707
}
2710
2708
if (jl_is_uniontype (ety)) {
2711
2709
Value *nbytes = ConstantInt::get (T_size, elsz);
2712
- Value *data = emit_arrayptr (ctx, ary, args[1 ]);
2710
+ Value *data = emit_bitcast (ctx, emit_arrayptr (ctx, ary, args[1 ]), T_pint8 );
2713
2711
if (!(rhs.typ == jl_bottom_type)) {
2714
2712
// compute tindex from rhs
2715
2713
jl_cgval_t rhs_union = convert_julia_type (ctx, rhs, ety);
@@ -2719,8 +2717,8 @@ static bool emit_builtin_call(jl_codectx_t &ctx, jl_cgval_t *ret, jl_value_t *f,
2719
2717
selidx = ctx.builder .CreateAdd (selidx, idx);
2720
2718
Value *ptindex = ctx.builder .CreateGEP (T_int8, data, selidx);
2721
2719
ctx.builder .CreateStore (tindex, ptindex);
2722
- if (jl_datatype_size (vty) == 0 ) {
2723
- assert ( jl_is_datatype (vty));
2720
+ if (jl_is_datatype (vty) && jl_datatype_size (vty) == 0 ) {
2721
+
2724
2722
}
2725
2723
else {
2726
2724
// copy data
0 commit comments