Skip to content

Commit

Permalink
fix bug in PR #21620
Browse files Browse the repository at this point in the history
would segfault when reaching the jl_datatype_nfields call
  • Loading branch information
vtjnash committed May 22, 2017
1 parent 51c5ef4 commit 8cc5e2b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3048,7 +3048,7 @@ static bool emit_builtin_call(jl_cgval_t *ret, jl_value_t *f, jl_value_t **args,
jl_datatype_t *sty = (jl_datatype_t*)expr_type(args[1], ctx);
rt1 = (jl_value_t*)sty;
jl_datatype_t *uty = (jl_datatype_t*)jl_unwrap_unionall((jl_value_t*)sty);
if (jl_is_structtype(uty) && uty != jl_module_type) {
if (jl_is_structtype(uty) && uty != jl_module_type && ((jl_datatype_t*)uty)->layout) {
size_t idx = (size_t)-1;
if (jl_is_quotenode(args[2]) && jl_is_symbol(jl_fieldref(args[2],0))) {
idx = jl_field_index(uty, (jl_sym_t*)jl_fieldref(args[2],0), 0);
Expand Down

0 comments on commit 8cc5e2b

Please sign in to comment.