Skip to content

Commit

Permalink
set does-not-return attribute on julia functions that don't return
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Jan 6, 2013
1 parent 7983e18 commit fbbb033
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1929,12 +1929,12 @@ static Function *emit_function(jl_lambda_info_t *lam)
// try to avoid conflicts in the global symbol table
funcName = "julia_" + funcName;

jl_value_t *jlrettype = jl_ast_rettype(lam, (jl_value_t*)ast);
if (specsig) {
std::vector<Type*> fsig(0);
for(size_t i=0; i < jl_tuple_len(lam->specTypes); i++) {
fsig.push_back(julia_type_to_llvm(jl_tupleref(lam->specTypes,i)));
}
jl_value_t *jlrettype = jl_ast_rettype(lam, (jl_value_t*)ast);
Type *rt = (jlrettype == (jl_value_t*)jl_nothing->type ? T_void : julia_type_to_llvm(jlrettype));
f = Function::Create(FunctionType::get(rt, fsig, false),
Function::ExternalLinkage, funcName, jl_Module);
Expand All @@ -1950,6 +1950,8 @@ static Function *emit_function(jl_lambda_info_t *lam)
lam->functionObject = (void*)f;
}
}
if (jlrettype == (jl_value_t*)jl_bottom_type)
f->setDoesNotReturn();

ctx.f = f;

Expand Down

2 comments on commit fbbb033

@WestleyArgentum
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I checkout this commit the package manager is a drunk man in a Formula One car.

I think this is causing #1908 ... but I don't know why.

@StefanKarpinski
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice detective work. Still not sure what the problem is, but this narrows it down considerably.

Please sign in to comment.