Bug 19941 – [ICE] Segmentation fault in ImplicitConvTo::visit(AddrExp*) at dmd/dcast.d(980)

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-06-05T19:03:14Z
Last change time
2019-06-15T15:22:19Z
Keywords
pull
Assigned to
No Owner
Creator
Iain Buclaw

Comments

Comment #0 by ibuclaw — 2019-06-05T19:03:14Z
immutable b = new a; class a { int c = &d; }
Comment #1 by ibuclaw — 2019-06-05T19:21:21Z
Related fail tests: immutable d = 42; immutable b = new a; class a { int c = d; } --- immutable b = new a; immutable d = 42; class a { int c = d; } --- immutable b = new a; class a { int c = d; } immutable d = 42; Swap the order of `class a` and `immutable b` declarations, and compilation succeeds, making this another forward reference bug.
Comment #2 by ibuclaw — 2019-06-06T18:34:16Z
Interestingly, it doesn't happen with const, enum or __gshared, only if the declaration is marked immutable or shared does it trigger the bug.
Comment #3 by dlang-bot — 2019-06-06T22:22:50Z
@ibuclaw created dlang/dmd pull request #9991 "fix Issue 19941 - [ICE] Segmentation fault in ImplicitConvTo::visit(AddrExp*) at dmd/dcast.d(980)" fixing this issue: - fix Issue 19941 - [ICE] Segmentation fault in ImplicitConvTo::visit(AddrExp*) at dmd/dcast.d(980) https://github.com/dlang/dmd/pull/9991
Comment #4 by dlang-bot — 2019-06-07T00:08:02Z
dlang/dmd pull request #9991 "fix Issue 19941 - [ICE] Segmentation fault in ImplicitConvTo::visit(AddrExp*) at dmd/dcast.d(980)" was merged into stable: - f11de557b9b007de2b22ce65452aa101a0db1604 by Iain Buclaw: fix Issue 19941 - [ICE] Segmentation fault in ImplicitConvTo::visit(AddrExp*) at dmd/dcast.d(980) https://github.com/dlang/dmd/pull/9991
Comment #5 by dlang-bot — 2019-06-09T14:08:32Z
dlang/dmd pull request #10005 "[dmd-cxx] fix Issue 19941 - [ICE] Segmentation fault in ImplicitConvTo::visit(AddrExp*) at dmd/dcast.d(980)" was merged into dmd-cxx: - d4e591119a38662b9fe6a87e8016924148175ffa by Iain Buclaw: fix Issue 19941 - [ICE] Segmentation fault in ImplicitConvTo::visit(AddrExp*) at dmd/dcast.d(980) https://github.com/dlang/dmd/pull/10005
Comment #6 by steven_kladitis — 2019-06-15T15:22:19Z
I see in the latest pull if (v->inuse || v->_scope == NULL || v->_init == NULL || I think it should be if (v->inuse || v->_scope is NULL || v->_init is NULL ||