[Issue 15629] [REG2.066.0] wrong code with "-O -inline" but correct with "-O"

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Feb 8 03:08:16 PST 2016


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

Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[REG] wrong code with "-O   |[REG2.066.0] wrong code
                   |-inline" but correct with   |with "-O -inline" but
                   |"-O"                        |correct with "-O"

--- Comment #4 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to Kenji Hara from comment #3)
> Dustmited case code:

Sorry, the reduced code cannot reproduce exactly same regression with the
original.
I'll open one more issue for that.

Correct minimized code is:

void main()
{
    int[] a = [3];
    int value = abs(a[0]);
    assert(a[0] == 3);
    writeln(value, " ", a);
}

Num abs(Num)(Num x)
{
    return x >= 0 ? x : -x;
}

struct File
{
    struct LockingTextWriter
    {
        this(File) {}

        ~this() @trusted {}
    }

    auto lockingTextWriter()
    {
        return LockingTextWriter();
    }
}

File stdout;

void writeln(T...)(T args)
{
    stdout.lockingTextWriter();
}

Introduced in:
https://github.com/D-Programming-Language/dmd/pull/3620
and its fixup PR:
https://github.com/D-Programming-Language/dmd/pull/3656

So this is a regression from 2.066.0.

--


More information about the Digitalmars-d-bugs mailing list