D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 17622 - [REG2.075.0-b1] Wrong code with appender and -inline
Summary: [REG2.075.0-b1] Wrong code with appender and -inline
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: No Owner
URL:
Keywords: wrong-code
: 17632 (view as issue list)
Depends on:
Blocks:
 
Reported: 2017-07-08 16:52 UTC by steven kladitis
Modified: 2017-08-16 13:20 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description steven kladitis 2017-07-08 16:52:00 UTC

    
Comment 1 steven kladitis 2017-07-08 16:57:02 UTC
when using -inline in 64 bit mode all apps I have the goto the web do not work.
-m64 -inline 
on windows 10 64 bit
Windows comes back with a message about debugging the app.
Without -inline they work.

compiler --> DMD32 D Compiler 2.075.0-b2
Comment 2 Vladimir Panteleev 2017-07-08 19:01:04 UTC
Please provide a full self-contained test case, so that we can reproduce the bug.
Comment 3 steven kladitis 2017-07-12 13:50:54 UTC
void main() {
    import std.stdio, std.base64, std.net.curl, std.string;
 
    const f = "http://rosettacode.org/favicon.ico".get.representation;
    Base64.encode(f).writeln;
}



---- the above fails in -m32 or -m64 when using -inline
-- without -inline they  execute immediately.
Comment 4 Vladimir Panteleev 2017-07-15 03:32:55 UTC
(In reply to steven kladitis from comment #3)
> ---- the above fails in -m32 or -m64 when using -inline

Thanks, reprocuded. Reducing.
Comment 5 Vladimir Panteleev 2017-07-15 03:50:12 UTC
This is a regression.

Introduced in https://github.com/dlang/dmd/pull/6852

Partial reduction:

//////////////// test.d ////////////////
void main()
{
    import std.array : appender;

    auto content = appender!(ubyte[])();

    auto rdg = ()
    {
        auto x = content.data;
    };

    content.put(new ubyte[912]);
}
////////////////////////////////////////
Comment 6 Vladimir Panteleev 2017-07-15 04:17:52 UTC
Reduced:

//////// test.d ///////
struct S
{
    int i;

    this(ubyte)
    {
        return;
    }

    void fun()
    {
        assert(i == 0);
    }
}

S make()
{
    return S(0);
}

void main()
{
    S s = make();

    auto rdg =
    {
        s.fun();
    };

    s.fun();
}
///////////////////////
Comment 7 Walter Bright 2017-08-02 09:00:11 UTC
https://github.com/dlang/dmd/pull/7056
Comment 8 Vladimir Panteleev 2017-08-03 03:46:05 UTC
*** Issue 14793 has been marked as a duplicate of this issue. ***
Comment 9 Martin Nowak 2017-08-03 17:05:56 UTC
*** Issue 17632 has been marked as a duplicate of this issue. ***
Comment 10 github-bugzilla 2017-08-03 17:10:20 UTC
Commits pushed to stable at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/c73fe970c2014058b9544524d1809180db13cfbb
fix Issue 17622 - [REG2.075.0-b1] Wrong code with appender and -inline

https://github.com/dlang/dmd/commit/17473d2e6248da9fbb746ed8314b0ee488961156
Merge pull request #7056 from WalterBright/fix17622

fix Issue 17622 - [REG2.075.0-b1] Wrong code with appender and -inline
merged-on-behalf-of: Martin Nowak <code@dawg.eu>
Comment 11 github-bugzilla 2017-08-16 13:20:05 UTC
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/c73fe970c2014058b9544524d1809180db13cfbb
fix Issue 17622 - [REG2.075.0-b1] Wrong code with appender and -inline

https://github.com/dlang/dmd/commit/17473d2e6248da9fbb746ed8314b0ee488961156
Merge pull request #7056 from WalterBright/fix17622