Skip to content

Commit

Permalink
move reinterpret error check inside box. fixes #8088
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Sep 19, 2014
1 parent b11d33c commit fd0075c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
7 changes: 1 addition & 6 deletions base/number.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,7 @@ done(x::Number, state) = state
isempty(x::Number) = false
in(x::Number, y::Number) = x == y

function reinterpret{T}(::Type{T}, x)
if !isbits(T)
error("cannot reinterpret to type ", T)
end
box(T,x)
end
reinterpret{T,S}(::Type{T}, x::S) = box(T,unbox(S,x))

map(f::Callable, x::Number) = f(x)

Expand Down
4 changes: 2 additions & 2 deletions src/intrinsics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,8 @@ static Value *generic_box(jl_value_t *targ, jl_value_t *x, jl_codectx_t *ctx)
if (bt == NULL) {
}
else if (!jl_is_bitstype(bt)) {
jl_error("box: expected bits type as first argument");
emit_error("reinterpret: expected bits type as first argument", ctx);
return UndefValue::get(jl_pvalue_llvmt);
}
else {
llvmt = julia_type_to_llvm(bt);
Expand All @@ -409,7 +410,6 @@ static Value *generic_box(jl_value_t *targ, jl_value_t *x, jl_codectx_t *ctx)
if (nb == -1) {
emit_error("box: could not determine argument size", ctx);
return UndefValue::get(jl_pvalue_llvmt);
//jl_error("box: could not determine argument size");

This comment has been minimized.

Copy link
@ivarne

ivarne Sep 22, 2014

Member

Trying to cherry-pick this commit, but I am getting a conflict because of a change in 114e4dcefc. Should I just keep the jl_error on release-0.3?

This comment has been minimized.

Copy link
@JeffBezanson

JeffBezanson Sep 22, 2014

Author Member

It would probably be ok to port over this change as well.

}

if (llvmt == NULL)
Expand Down

0 comments on commit fd0075c

Please sign in to comment.