digitalmars.D.bugs - [Issue 5798] New: Swap and comma operator
- d-bugmail puremagic.com (43/43) Mar 30 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5798
- d-bugmail puremagic.com (27/27) Mar 30 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5798
- d-bugmail puremagic.com (26/26) Apr 19 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5798
- d-bugmail puremagic.com (29/29) Apr 25 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5798
- d-bugmail puremagic.com (12/12) May 05 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5798
- d-bugmail puremagic.com (12/12) Jun 24 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5798
- d-bugmail puremagic.com (10/10) Jun 24 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5798
- d-bugmail puremagic.com (18/18) Jun 24 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5798
- d-bugmail puremagic.com (12/12) Jul 14 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5798
http://d.puremagic.com/issues/show_bug.cgi?id=5798 Summary: Swap and comma operator Product: D Version: D2 Platform: Other OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: timon.gehr gmx.ch Hello, The following code fails the assertion: import std.algorithm; import std.stdio; int main(){ int a=1,b=0,c; swap(a,b),c=b; assert(a==0); return 0; } (This one passes: import std.stdio; int main(){ int a=1,b=0,c; tmp=b,b=a,a=tmp,c=b; assert(a==0); return 0; } As well as this one: import std.algorithm; import std.stdio; int main(){ int a=1,b=0,c; swap(a,b);c=b; assert(a==0); return 0; } ) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 30 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5798 kennytm gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kennytm gmail.com Test case that does not depend on Phobos: void assign9(ref int lhs) pure { lhs = 9; } void assign8(ref int rhs) pure { rhs = 8; } int main(){ int a=1,b=2; assign8(b),assign9(a); assert(a == 9); assert(b == 8); // <-- fail assign9(b),assign8(a); assert(a == 8); assert(b == 9); // <-- fail return 0; } Removing the 'pure' attributes make all asserts pass. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 30 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5798 timon.gehr gmx.ch changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch Severity|normal |major I changed importance to mayor, because this also affects some compiler rewrites, and the fix is trivial. Eg: int weakly_pure_function(out param)pure{...} 1^^weakly_pure_function(param), will be optimized away to (weakly_pure_function(param),1) and then only 1, without setting the param. This bug exists because the compiler incorrectly assumes that a weakly pure function has no side effects. Suggested fix: in expression.c, function CallExp::checkSideEffect, replace (~line 7278) - if (t->ty == Tfunction && ((TypeFunction *)t)->purity) - return 0; by + if (t->ty == Tfunction && ((TypeFunction *)t)->purity > PUREweak) + return 0; -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 19 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5798 Comma expression is also used in for-loops, which may trigger this bug. In particular, the equal() function since commit ec2c8460* does not work with a range with pure popFront() since it says for (; !r1.empty; r1.popFront(), r2.popFront()) // ^ For instance, the following code, which works in 2.052, no longer work in the git master version: ----------------------------------------------------------------- import std.array, std.algorithm; struct X { int _front; pure nothrow: property int front() const { return _front; } void popFront() { ++ _front; } property bool empty() const { return _front == 10; } } void main() { X x; //assert(equal(array(x), [0,1,2,3,4,5,6,7,8,9])); // ok x._front = 0; assert(equal(x, [0,1,2,3,4,5,6,7,8,9])); // asserts } ----------------------------------------------------------------- * https://github.com/D-Programming-Language/phobos/commit/ec2c8460#L0R4324 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 25 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5798 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED 23:56:25 PDT --- https://github.com/D-Programming-Language/dmd/commit/125e81535a2473f485df4f09fe90a900ea2e054b -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 05 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5798 kennytm gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED | I thought this in a 'for' loop (comment 3) has been fixed, but it doesn't. Re-opening. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 24 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5798 kennytm gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla kyllingen.net *** Issue 6206 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 24 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5798 02:39:10 PDT --- Adding my test case from issue 6206 here, since it's much smaller and doesn't pull in any Phobos modules. struct S { int i = 0; void incr() pure { ++i; } } void main() { S s; for (int j=0; j<10; s.incr(), ++j) { } assert (s.i == 10); // fails } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 24 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5798 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED CC| |yebblies gmail.com Resolution| |FIXED These all seem to be working with dmd 2.054 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 14 2011