www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1058] New: DMD hangs with 100% CPU

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1058

           Summary: DMD hangs with 100% CPU
           Product: D
           Version: 1.009
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: vlasov scatt.com


DMD 1.009 and 1.007 hangs compiling that:

---- module test.d
module test;

class A
{
  B     _b;
  B b() { return _b; }

  protected this() {}
}

struct B
{
}


---- output
dmd -c test.d -v
parse test semantic test import object (c:\dmd\bin\..\src\phobos\object.d) --
Mar 12 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1058


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com





The spec doesn't make it obvious whether empty structs are supposed to be
allowed.  But they show up as being one byte in size when I experiment.


-- 
Mar 14 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1058






yes, seems i tried too hard to provide as small example as possible ;-)

it still hang if struct contain members. moving constructor above "B _b" makes
compiler happy.


-- 
Mar 14 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1058


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|DMD hangs with 100% CPU     |DMD hangs with 100% CPU -
                   |                            |member function returning
                   |                            |forward-referenced struct
                   |                            |before constructor





I've tried a few different permutations, and it appears that the bug shows as
long as A is defined before B, and b() is defined before this().


-- 
Mar 15 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1058


thomas-dloop kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|Windows                     |All





Added to DStress as
http://dstress.kuehne.cn/run/f/forward_reference_19_A.d
http://dstress.kuehne.cn/run/f/forward_reference_19_B.d
http://dstress.kuehne.cn/run/f/forward_reference_19_C.d
http://dstress.kuehne.cn/run/f/forward_reference_19_D.d
http://dstress.kuehne.cn/run/f/forward_reference_19_E.d


-- 
Mar 29 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1058






This also hangs the compiler with 100% CPU usage.
Not sure if this is the same issue or a different one, but it certainly looks
similar. Should it be added to DStress?

Note the comments sample - moving the declaration up or removing static from
declaration of makeS() fixes the hang issue.

class Klass
{
    protected S _s;

    public void one()
    {
        makesS();
    }

    //Move this up to fix hang
    struct S{int a;}

    //Making this non-static fixes hang
    protected static S makesS()
    {
        S s;
        return s;
    }
}

int main(){return 0;}


-- 
Jul 07 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1058






This looks a lot like bug 1206 too.
http://d.puremagic.com/issues/show_bug.cgi?id=1206

1206 is marked "Fixed DMD 1.018 and DMD 2.002".

Does this bug still occur in those versions of DMD?


-- 
Jul 08 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1058







 This looks a lot like bug 1206 too.
 http://d.puremagic.com/issues/show_bug.cgi?id=1206
 
 1206 is marked "Fixed DMD 1.018 and DMD 2.002".
 
 Does this bug still occur in those versions of DMD?
 
The sample I provided works fine in 1.018. --
Jul 08 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1058


davidl 126.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





i tested with dmd 1.021 seems already get fixed 


-- 
Sep 20 2007