Bug 4983 – [ICE] Stack overflow while initializing struct member with address of one of its methods

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-10-02T21:45:00Z
Last change time
2013-11-21T21:51:41Z
Keywords
ice, pull
Assigned to
nobody
Creator
2korden

Comments

Comment #0 by 2korden — 2010-10-02T21:45:09Z
struct Foo { void bar() { } void delegate() dg = &Foo.init.bar; } # dmd test.d Stack overflow
Comment #1 by lovelydear — 2012-04-20T09:14:07Z
This is a recursive definition, I guess this should be expected. Lowering to minor issue.
Comment #2 by dmitry.olsh — 2012-04-20T11:51:17Z
Compier stackoverflows and segfaults are NOT minor issue.
Comment #3 by k.hara.pg — 2012-05-30T20:42:22Z
Changed importance to 'major'.
Comment #4 by k.hara.pg — 2012-06-01T05:21:44Z
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))) ...
Comment #5 by k.hara.pg — 2013-11-21T19:37:36Z
Comment #6 by github-bugzilla — 2013-11-21T21:43:54Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/ea594913e1ec5d050af0c8bbf6c9a2ff6fea5995 fix Issue 4983 - [ICE] Stack overflow while initializing struct member with address of one of its methods https://github.com/D-Programming-Language/dmd/commit/3f51edc81a9465fd896acfb1f42a81acb90397f7 Merge pull request #2849 from 9rnsr/fix4983 Issue 4983 - [ICE] Stack overflow while initializing struct member with address of one of its methods