[Issue 9356] -inline with inout and append generates wrong code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 23 23:21:33 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9356


Rainer Schuetze <r.sagitario at gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario at gmx.de


--- Comment #1 from Rainer Schuetze <r.sagitario at gmx.de> 2013-06-23 23:21:31 PDT ---
I have hit this bug with a recent commit to druntime that changes the
implementation of AssociativeArray.keys:

import std.stdio;

void main()
{
    string[] files;
    files ~= "1";
    files ~= "2";

    byte[string] cache;
    cache["3"] = 1;
    cache["4"] = 1;

    files ~= cache.keys;
    writeln(files);
}

when compiled with -inline, it prints

["1", "2", "\x01\x00"]

This seems to be caused by inout(T[]) not being appendable to T[]. Instead it
is appended as a single element (_d_arrayappendcT is called, see
CatAssignExp::toElem).

In case of AssociativeArray.keys, there also seems to be a problem that
inlining seems to ignore implicite conversion on the return type by the inlined
function.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list