digitalmars.D.bugs - [Issue 5545] New: [64-bit] DMD fails to postincrement ubytes.
- d-bugmail puremagic.com (45/45) Feb 07 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5545
- d-bugmail puremagic.com (13/13) Feb 07 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5545
http://d.puremagic.com/issues/show_bug.cgi?id=5545 Summary: [64-bit] DMD fails to postincrement ubytes. Product: D Version: D2 Platform: x86_64 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: dsimcha yahoo.com --- Comment #0 from David Simcha <dsimcha yahoo.com> 2011-02-07 16:38:10 PST --- I apologize for the length of this test case, it was reduced from a ~1500 line file with a failing unittest. The following bug seems to be caused by DMD failing to increment i in the struct Perm. It only happens under -O -release -m64. Omitting any of these flags makes this program work. Also, the call to enforce() is necessary to reproduce the bug. import std.stdio; bool enforce(bool value, lazy const(char)[] msg = null) { if(!value) { return false; } return value; } struct Perm { byte[3] perm; ubyte i; this(byte[] input) { foreach(elem; input) { enforce(i < 3); perm[i++] = elem; stderr.writeln(i); // Never gets incremented. Stays at 0. } } } void main() { byte[] stuff = [0, 1, 2]; auto perm2 = Perm(stuff); writeln(perm2.perm); // Prints [2, 0, 0] assert(perm2.perm[] == [0, 1, 2]); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 07 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5545 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED --- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2011-02-07 22:34:30 PST --- https://github.com/D-Programming-Language/dmd/commit/64b9981229ee44b6126b96222936bd5c35be0e59 https://github.com/D-Programming-Language/dmd/commit/57eddad8d3484ee64736be21ddad1873365fc9b8 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 07 2011