mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-03-04 03:23:14 +01:00
Emit all D inline asm labels as local labels.
On OS X, there is an actual significance to the distinction, which before lead e.g. to exception throwing in the below example being broken:
---
import core.exception;
void main() {
asm {
jmp Lfoo;
Lfoo:
;
}
throw cast(OutOfMemoryError)cast(void*)OutOfMemoryError.classinfo.init;
assert(0);
}
---
This commit is contained in:
@@ -1388,10 +1388,10 @@ void LabelStatement::toIR(IRState* p)
|
||||
if (p->asmBlock)
|
||||
{
|
||||
IRAsmStmt* a = new IRAsmStmt;
|
||||
a->code += p->func()->decl->mangle();
|
||||
a->code += "_";
|
||||
a->code += ident->toChars();
|
||||
a->code += ":";
|
||||
std::stringstream label;
|
||||
printLabelName(label, p->func()->decl->mangle(), ident->toChars());
|
||||
label << ":";
|
||||
a->code = label.str();
|
||||
p->asmBlock->s.push_back(a);
|
||||
p->asmBlock->internalLabels.push_back(ident);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user