mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-09-17 19:07:05 +02:00
Fixed segfault on invalid naked functions.
Emitting a frontend error during codegen is somewhat problematic in any case, but stopping if an error ocurred should work just fine here.
This commit is contained in:
+6
-1
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
void Statement::toNakedIR(IRState *p)
|
void Statement::toNakedIR(IRState *p)
|
||||||
{
|
{
|
||||||
error("not allowed in naked function");
|
error("statement not allowed in naked function");
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -179,6 +179,11 @@ void DtoDefineNakedFunction(FuncDeclaration* fd)
|
|||||||
// emit body
|
// emit body
|
||||||
fd->fbody->toNakedIR(gIR);
|
fd->fbody->toNakedIR(gIR);
|
||||||
|
|
||||||
|
// We could have generated new errors in toNakedIR(), but we are in codegen
|
||||||
|
// already so we have to abort here.
|
||||||
|
if (global.errors)
|
||||||
|
fatal();
|
||||||
|
|
||||||
// emit size after body
|
// emit size after body
|
||||||
// llvm does this on linux, but not on osx or Win
|
// llvm does this on linux, but not on osx or Win
|
||||||
if (global.params.os != OSMacOSX && global.params.os != OSWindows)
|
if (global.params.os != OSMacOSX && global.params.os != OSWindows)
|
||||||
|
|||||||
Reference in New Issue
Block a user