digitalmars.D.bugs - [Issue 5809] New: feqrel fails assert in std.math on x86_64 systems
- d-bugmail puremagic.com (18/18) Apr 03 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5809
- d-bugmail puremagic.com (7/7) Apr 03 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5809
- d-bugmail puremagic.com (7/7) Apr 03 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5809
- d-bugmail puremagic.com (11/11) Dec 21 2011 http://d.puremagic.com/issues/show_bug.cgi?id=5809
- d-bugmail puremagic.com (15/16) Apr 23 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5809
- d-bugmail puremagic.com (30/30) May 08 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5809
- d-bugmail puremagic.com (10/10) May 10 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5809
- d-bugmail puremagic.com (17/17) May 10 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5809
- d-bugmail puremagic.com (7/7) May 10 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5809
- d-bugmail puremagic.com (10/10) May 10 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5809
- d-bugmail puremagic.com (9/9) May 10 2012 http://d.puremagic.com/issues/show_bug.cgi?id=5809
http://d.puremagic.com/issues/show_bug.cgi?id=5809 Summary: feqrel fails assert in std.math on x86_64 systems Product: D Version: D1 & D2 Platform: x86_64 OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: moritzwarning web.de --- Comment #0 from Moritz Warning <moritzwarning web.de> 2011-04-03 16:28:16 PDT --- On x86_64 systems this assert fails because feqrel returns to 0. assert(feqrel(real.min_normal/8,real.min_normal/17)==3); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 03 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5809 --- Comment #1 from Moritz Warning <moritzwarning web.de> 2011-04-03 16:28:44 PDT --- Here is the link into Phobos: https://github.com/D-Programming-Language/phobos/blob/master/std/math.d#L3634 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 03 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5809 --- Comment #2 from Moritz Warning <moritzwarning web.de> 2011-04-03 16:30:07 PDT --- It works when a dummy function call is inserted before "if (pd[F.EXPPOS_SHORT] == 0)" inside feqrel. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 03 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5809 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code CC| |clugdbug yahoo.com.au --- Comment #3 from Don <clugdbug yahoo.com.au> 2011-12-21 13:02:13 PST --- This sounds like a compiler bug. Does it still fail on 2.057? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 21 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5809 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla digitalmars.com --- Comment #4 from Walter Bright <bugzilla digitalmars.com> 2012-04-23 17:34:36 PDT --- (In reply to comment #3)Does it still fail on 2.057?Works on 32 bit Linux, fails on 64 bit Linux. Test program: import std.math; void main() { assert(feqrel(real.min_normal/8,real.min_normal/17)==3); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 23 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5809 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|feqrel fails assert in |[64 bit] wrong code for |std.math on x86_64 systems |*p==0, when widening | |conversion occurs Severity|normal |blocker --- Comment #5 from Don <clugdbug yahoo.com.au> 2012-05-08 22:08:29 PDT --- Original title: feqrel fails assert in std.math on x86_64 systems Reduced test case shows it is a backend bug. The common subexpression *px gets extended to int when calculating b. Inside the assert it is treated as *cast(int *)px, so that it picks up x[1] instead of just x[0]. It seems to only apply to comparisons with 0. Subtle and disastrous, raising severity to blocker. void main() { ushort[2] x = void; x[0] = 0; x[1] = 0x1234; ushort *px = &x[0]; uint b = px[0]; // this causes the next line to fail assert(px[0] == 0); } It generates cmp dword ptr -010h[RBP],0 should be word ptr, which doesn't exist in 64bit. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 08 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5809 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #6 from Don <clugdbug yahoo.com.au> 2012-05-10 00:53:24 PDT --- https://github.com/D-Programming-Language/dmd/pull/937 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 10 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5809 --- Comment #7 from Don <clugdbug yahoo.com.au> 2012-05-10 07:02:10 PDT --- My pull request is wrong. The correct fix is in cgcod.c, line 1795. In moving to 64 bit, commit 3cdb9f520e0bac17f6da00ef9de86c81e23429aa made this change: c = genc(NULL,0x81 ^ byte,modregrm(2,7,BPRM), FLcs,i, FLconst,(targ_uns) 0); - if (REGSIZE == 4 && sz == 2) + if (I32 && sz == 2) c->Iflags |= CFopsize; } But this is wrong, it should be + if ((I32 || I64) && sz == 2) This code is now in cod3.c, testcse(), line 1795. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 10 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5809 --- Comment #8 from Don <clugdbug yahoo.com.au> 2012-05-10 07:22:16 PDT --- Fixed pull request. https://github.com/D-Programming-Language/dmd/pull/938 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 10 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5809 --- Comment #9 from github-bugzilla puremagic.com 2012-05-10 10:05:33 PDT --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/7c2ea37c476a2d7a289f54cbf1ee0e692d7a69a0 Fix issue 5809: [64 bit] wrong code for *p==0, when widening conversion occurs Bug was introduced in commit 3cdb9f52, but it never worked on 64bits, so it is not a regression. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 10 2012
http://d.puremagic.com/issues/show_bug.cgi?id=5809 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 10 2012