Thread overview
[Issue 1058] New: DMD hangs with 100% CPU
Mar 13, 2007
d-bugmail
Mar 14, 2007
d-bugmail
Mar 14, 2007
d-bugmail
[Issue 1058] DMD hangs with 100% CPU - member function returning forward-referenced struct before constructor
Mar 15, 2007
d-bugmail
Mar 29, 2007
d-bugmail
Jul 07, 2007
d-bugmail
Jul 08, 2007
d-bugmail
Jul 09, 2007
d-bugmail
Sep 20, 2007
d-bugmail
March 13, 2007
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)


-- 

March 14, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1058


smjg@iname.com changed:

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




------- Comment #1 from smjg@iname.com  2007-03-14 14:19 -------
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.


-- 

March 14, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1058





------- Comment #2 from vlasov@scatt.com  2007-03-14 14:35 -------
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.


-- 

March 15, 2007
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




------- Comment #3 from smjg@iname.com  2007-03-15 10:42 -------
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().


-- 

March 29, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1058


thomas-dloop@kuehne.cn changed:

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




------- Comment #4 from thomas-dloop@kuehne.cn  2007-03-29 14:08 -------
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


-- 

July 07, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1058





------- Comment #5 from nick.atamas@gmail.com  2007-07-07 17:05 -------
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;}


-- 

July 08, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1058





------- Comment #6 from wbaxter@gmail.com  2007-07-08 18:54 -------
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?


-- 

July 09, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1058





------- Comment #7 from nick.atamas@gmail.com  2007-07-08 19:01 -------
(In reply to comment #6)
> 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.


-- 

September 20, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1058


davidl@126.com changed:

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




------- Comment #8 from davidl@126.com  2007-09-20 04:06 -------
i tested with dmd 1.021 seems already get fixed


--