digitalmars.D.bugs - [Issue 9356] New: -inline with inout and append generates wrong code
- d-bugmail puremagic.com (35/35) Jan 20 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9356
- d-bugmail puremagic.com (10/10) Feb 06 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9356
- d-bugmail puremagic.com (31/31) Jun 23 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9356
- d-bugmail puremagic.com (16/16) Jun 28 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9356
http://d.puremagic.com/issues/show_bug.cgi?id=9356 Summary: -inline with inout and append generates wrong code Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: doob me.com The assert in "foo" passes, which it obviously shouldn't. inout(char)[] bar (inout(char)[] a) { return a; } void foo (string str) { string result; result ~= bar(str); assert(result == "!"); } void main () { foo("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); } If I remove "inout" in "bar" or the append in "foo" the code work as expected. What "result" will actually be depends on the length of the string passed to "foo". I've only tried this with on Mac OS X, both 32 and 64bit. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 20 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9356 Denis Shelomovskij <verylonglogin.reg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code CC| |verylonglogin.reg gmail.com Severity|normal |major -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 06 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9356 Rainer Schuetze <r.sagitario gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |r.sagitario gmx.de 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: -------
Jun 23 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9356 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull CC| |yebblies gmail.com AssignedTo|nobody puremagic.com |yebblies gmail.com Yeah, the inliner ends up replacing the call expression with the return expression, but doesn't re-paint the type to account for castless implicit conversions. e2ir uses if/else when it should be using if/elseif/else assert, so it generates wrong code instead of ICEing. https://github.com/D-Programming-Language/dmd/pull/2269 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 28 2013