Thread overview
[Issue 4983] New: Stack overflow while initializing struct member with address of one of its methods
Oct 03, 2010
Koroskin Denis
Apr 20, 2012
SomeDude
Apr 20, 2012
Dmitry Olshansky
[Issue 4983] [ICE] Stack overflow while initializing struct member with address of one of its methods
May 31, 2012
Kenji Hara
Jun 01, 2012
Kenji Hara
October 03, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4983

           Summary: Stack overflow while initializing struct member with
                    address of one of its methods
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: 2korden@gmail.com


--- Comment #0 from Koroskin Denis <2korden@gmail.com> 2010-10-02 21:45:09 PDT ---
struct Foo
{
    void bar()
    {
    }

    void delegate() dg = &Foo.init.bar;
}

# dmd test.d
Stack overflow

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 20, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4983


SomeDude <lovelydear@mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear@mailmetrash.com
           Severity|normal                      |minor


--- Comment #1 from SomeDude <lovelydear@mailmetrash.com> 2012-04-20 09:14:07 PDT ---
This is a recursive definition, I guess this should be expected. Lowering to minor issue.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 20, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4983


Dmitry Olshansky <dmitry.olsh@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmitry.olsh@gmail.com
           Severity|minor                       |normal


--- Comment #2 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2012-04-20 11:51:17 PDT ---
Compier stackoverflows and segfaults are NOT minor issue.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 31, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4983


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Stack overflow while        |[ICE] Stack overflow while
                   |initializing struct member  |initializing struct member
                   |with address of one of its  |with address of one of its
                   |methods                     |methods
           Severity|normal                      |major


--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2012-05-30 20:42:22 PDT ---
Changed importance to 'major'.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
June 01, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4983



--- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> 2012-06-01 05:21:44 PDT ---
More simple case:

  struct Foo { int dg = &Foo.init; }

In AddrExp, compiler will try to convert Foo.init to lvalue with Expression::toLvalue, but it is not possible, then try to output an error message like "Foo(...) is not an lvalue".

But, the initializer of the field dg contains Foo.init itself. So it will occurs *recursive printing*.

  Foo(Foo.init) -> Foo(Foo(Foo.init)) -> Foo(Foo(Foo(Foo.init))) ...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------