digitalmars.D.bugs - [Issue 2766] New: DMD hangs with 0%cpu
- d-bugmail puremagic.com (20/20) Mar 27 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2766
- d-bugmail puremagic.com (26/26) Mar 29 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2766
- d-bugmail puremagic.com (4/4) Mar 29 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2766
- d-bugmail puremagic.com (9/9) Apr 01 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2766
http://d.puremagic.com/issues/show_bug.cgi?id=2766 Summary: DMD hangs with 0%cpu Product: D Version: 2.026 Platform: PC OS/Version: Windows Status: NEW Severity: critical Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: benoit tionex.de compile with "dmd -c t.d" const byte[] A = [ cast(byte)0 ]; void f( byte* p){ } void func(){ f(A.ptr); } --
Mar 27 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2766 Created an attachment (id=299) --> (http://d.puremagic.com/issues/attachment.cgi?id=299&action=view) Potential fix - prevent recursion if optimized type matches. I'm not sure this is the right solution, but this does solve this problem. The stack is overflowing (eventually), for some reason this is causing a hang. byte*. This seems like something one might see a lot, actually. What's happening is, |Expression::implicitConvTo()| gets called being |cast(const(byte)*)cast(const(byte)*)[cast(byte)0]|. The optimize() call strips off one of those casts and returns a new |e|, so it calls itself on the optimized one. But somehow, that mangy cast gets back in there, and it recurses endlessly like this. Visual Studio doesn't show any calls between calls to |Expression::implicitConvTo()|, but I'm not seeing where it is changing. Nonetheless, |e| and |this| are different each time. However, the purpose of this recursion seems to simply be to properly check the optimized type. If the optimizer didn't change this type, it hardly seems necessary to recurse. This also happens in |Expression::implicitCastTo()|. Still, there is a deeper problem where the cast is doubling up. This works around the issue (hopefully not incorrectly), but does not solve the root issue. -[Unknown] --
Mar 29 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2766 I've got it fixed, so don't worry about it further. -Walter --
Mar 29 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2766 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Fixed DMD 2.027 --
Apr 01 2009