Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initializer the union selector of undefined upsilon nodes #29158

Merged
merged 1 commit into from
Dec 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6184,10 +6184,18 @@ static std::unique_ptr<Module> emit_function(
// If the val is null, we can ignore the store.
// The middle end guarantees that the value from this
// upsilon node is not dynamically observed.
jl_varinfo_t &vi = ctx.phic_slots[upsilon_to_phic[cursor+1]];
if (val) {
jl_cgval_t rval_info = emit_expr(ctx, val);
jl_varinfo_t &vi = ctx.phic_slots[upsilon_to_phic[cursor+1]];
emit_varinfo_assign(ctx, vi, rval_info);
} else if (vi.pTIndex) {
// We don't care what the contents of the variable are, but it
// does need to satisfy the union invariants (i.e. inbounds
// tindex).
ctx.builder.CreateStore(
vi.boxroot ? ConstantInt::get(T_int8, 0x80) :
ConstantInt::get(T_int8, 0x01),
vi.pTIndex, true);
}
find_next_stmt(cursor + 1);
continue;
Expand Down
11 changes: 11 additions & 0 deletions test/core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6794,3 +6794,14 @@ let a = [1,2,3,4,missing,6,7]
foo(x) = x > 0 ? x : missing
@test_throws TypeError foo(missing)
end

# issue #29152
function f29152()
try
g29152()
finally
end
end
g29152() = (_true29152 ? error() : _true29152 ? 0 : false)
_true29152 = true;
@test_throws ErrorException f29152()