digitalmars.D.bugs - [Issue 23781] New: [ICE] Segmentation Fault when taking the address
- d-bugmail puremagic.com (75/75) Mar 15 2023 https://issues.dlang.org/show_bug.cgi?id=23781
https://issues.dlang.org/show_bug.cgi?id=23781 Issue ID: 23781 Summary: [ICE] Segmentation Fault when taking the address of a ref return at CTFE Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: pro.mathias.lang gmail.com ``` struct Bar { int i; } ref const(Bar) func1 (const return ref Bar b) { return b; } immutable E1 = Bar(); enum E2 = &E1.func1(); ``` ``` Program received signal SIGSEGV, Segmentation fault. 0x00005555559ea2e0 in Interpreter::visit(AddrExp*) (this=0x7fffffffced0, e=0x7ffff73366d0) at src/dmd/dinterpret.d:2039 2039 if (ve.var == istate.fd.vthis) (gdb) bt e=0x7ffff73366d0) at src/dmd/dinterpret.d:2039 v=0x7fffffffced0) at src/dmd/expression.d:5359 _D3dmd10dinterpret9interpretFPSQBd10expression8UnionExpCQCcQz10ExpressionPSQCvQCu10InterStateEQDoQDn8CTFEGoalZQCd ( goal=<incomplete type>, istate=0x0, e=0x7ffff73366d0, pue=0x7fffffffcf30) at src/dmd/dinterpret.d:6552 _D3dmd10dinterpret9interpretFCQBc10expression10ExpressionPSQCfQCe10InterStateEQCyQCx8CTFEGoalZQCn ( goal=<incomplete type>, istate=0x0, e=0x7ffff73366d0) at src/dmd/dinterpret.d:6562 _D3dmd10dinterpret13ctfeInterpretFCQBh10expression10ExpressionZQBd (e=0x7ffff73366d0) at src/dmd/dinterpret.d:101 src/dmd/expression.d:1683 _D3dmd7initsem19initializerSemanticRCQBj4init11InitializerPSQCg6dscope5ScopeKCQCy5mtype4TypeEQDnQCe13NeedInterpretZ8visitExpMFCQEvQDm14ExpInitializerZQEk (__capture=0x7fffffffd2a0, i=0x7ffff7b06a60) at src/dmd/initsem.d:374 _D3dmd7initsem19initializerSemanticRCQBj4init11InitializerPSQCg6dscope5ScopeKCQCy5mtype4TypeEQDnQCe13NeedInterpretZ5visit16VisitInitializerMFQEbZQEf (__capture=0x7fffffffd2a0, init=0x7ffff7b06a60) at src/dmd/init.d-mixin-366:372 NeedInterpret) (init=0x7ffff7b06a60, sc=0x7ffff73312f0, tx= 0x7ffff7b06ae0: 0x7ffff73311f0, needInterpret=<incomplete type>) at src/dmd/initsem.d:962 (this=0x7fffffffd350, vd=0x7ffff7b06a90) at src/dmd/semantic2.d:276 (this=0x7ffff7b06a90, v=0x7fffffffd350) at src/dmd/declaration.d:1724 sc=0x7ffff73312f0) at src/dmd/semantic2.d:79 (this=0x7fffffffd410, mod=0x7ffff7b057a0) at src/dmd/semantic2.d:356 v=0x7fffffffd410) at src/dmd/dmodule.d:1261 sc=0x0) at src/dmd/semantic2.d:79 (params=..., argv=0x7fffffffdc98, argc=2) at src/dmd/mars.d:462 ``` Build from master as of today (2.102), has been crashing since 2.098 (error before). The underlying problem seems to be the way CTFE handles `CommaExp` rewrites. --
Mar 15 2023