digitalmars.D.bugs - [Issue 6281] New: [CTFE] A null pointer '!is null' returns 'true'.
- d-bugmail puremagic.com (30/30) Jul 10 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6281
- d-bugmail puremagic.com (11/11) Jul 10 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6281
- d-bugmail puremagic.com (12/27) Jul 20 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6281
- d-bugmail puremagic.com (13/13) Jul 26 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6281
http://d.puremagic.com/issues/show_bug.cgi?id=6281 Summary: [CTFE] A null pointer '!is null' returns 'true'. Product: D Version: D2 Platform: Other OS/Version: Mac OS X Status: NEW Keywords: wrong-code Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: kennytm gmail.com --- Comment #0 from kennytm gmail.com 2011-07-10 11:15:16 PDT --- Test case: ------------------------ static assert(!{ auto p = null; return p !is null; }()); ------------------------ x.d(1): Error: static assert (!true) is false ------------------------ The problem is the strange statement 'cmp ^= -1' in https://github.com/D-Programming-Language/dmd/blob/master/src/interpret.c#L2338. When two pointers are both null, 'cmp' will be 1, and 'cmp ^ -1' is -2 which is also true. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 10 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6281 kennytm gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch --- Comment #1 from kennytm gmail.com 2011-07-10 11:23:03 PDT --- DMD pull #229. https://github.com/D-Programming-Language/dmd/pull/229 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 10 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6281 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug yahoo.com.au --- Comment #2 from Don <clugdbug yahoo.com.au> 2011-07-20 16:23:32 PDT --- (In reply to comment #0)Test case: ------------------------ static assert(!{ auto p = null; return p !is null; }()); ------------------------ x.d(1): Error: static assert (!true) is false ------------------------ The problem is the strange statement 'cmp ^= -1' in https://github.com/D-Programming-Language/dmd/blob/master/src/interpret.c#L2338. When two pointers are both null, 'cmp' will be 1, and 'cmp ^ -1' is -2 which is also true.IIRC that was copied from Equals() in constfold.c. The bug probably exists there as well. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 20 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6281 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED --- Comment #3 from Walter Bright <bugzilla digitalmars.com> 2011-07-26 13:45:26 PDT --- https://github.com/D-Programming-Language/dmd/commit/90f82ecf1376a20d39326c9033115f43fd8569dd https://github.com/D-Programming-Language/dmd/commit/000097b71f8ed2be69be36c1094efe694fb82a72 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 26 2011