[Issue 11471] [profile+nothrow] `asm` statements rejected in `nothrow` functions if built with "-profile"

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Jun 20 09:59:24 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=11471

--- Comment #6 from Kenji Hara <k.hara.pg at gmail.com> ---
The root issue is in FuncDeclaration::semantic3.

    ...
    else if (hasReturnExp & 8)               // if inline asm
    {
        flags &= ~FUNCFLAGnothrowInprocess;
    }
    else
    {
        // Check for errors related to 'nothrow'.
        unsigned int nothrowErrors = global.errors;
        int blockexit = fbody->blockExit(this, f->isnothrow);
        if (f->isnothrow && (global.errors != nothrowErrors) )
            ::error(loc, "%s '%s' is nothrow yet may throw", kind(),
toPrettyChars());
    ...

In front-end, if a function body has inline asm statements, the function's
nothrow check is skipped! But many functions in druntime rely on the loose
behavior currently.

--


More information about the Digitalmars-d-bugs mailing list