Bug 22226 – [REG 2.095.1] __ctfe + function call in conditional expression used to initialize struct member in constructor causes ICE

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-08-19T22:06:15Z
Last change time
2021-10-08T07:02:42Z
Keywords
backend, ice, pull
Assigned to
No Owner
Creator
Paul Backus
Blocks
22117

Comments

Comment #0 by snarwin+bugzilla — 2021-08-19T22:06:15Z
As of DMD 2.097.2, attempting to compile the following program causes DMD to crash due to a segmentation fault: --- struct A {} A move(A a) { return A.init; } struct SumType { A a; this(A value) { a = __ctfe ? value : move(value); } } --- According to run.dlang.io, this is a regression introduced in DMD 2.095.1: --- Up to 2.094.1: Success and no output Since 2.095.1: Segfault and no output --- Attempting to compile the above program using a build of DMD with assertions enabled results in the following error message: --- dmd: src/dmd/backend/cod3.d:1391: Assertion `t' failed. ---
Comment #1 by snarwin+bugzilla — 2021-08-19T23:31:00Z
Comment #2 by dlang-bot — 2021-08-20T09:42:25Z
@BorisCarvajal created dlang/dmd pull request #12995 "Fix Issue 22226 - [REG 2.095.1] __ctfe + function call in conditional…" fixing this issue: - Fix Issue 22226 - [REG 2.095.1] __ctfe + function call in conditional expression used to initialize struct member in constructor causes ICE https://github.com/dlang/dmd/pull/12995
Comment #3 by dlang-bot — 2021-08-23T09:14:13Z
dlang/dmd pull request #12995 "Fix Issue 22226 - [REG 2.095.1] __ctfe + function call in conditional…" was merged into master: - 294a4b3e1da7ca02532cea053ecfcc52af7f077b by Boris Carvajal: Fix Issue 22226 - [REG 2.095.1] __ctfe + function call in conditional expression used to initialize struct member in constructor causes ICE https://github.com/dlang/dmd/pull/12995
Comment #4 by dlang-bot — 2021-10-05T10:06:57Z
dlang/dmd pull request #13129 "[stable] Cherry-pick #12995 (backend ICE)" was merged into stable: - ba06e7ab18a213f8f59f1f7263c13734bcad4936 by Boris Carvajal: Fix Issue 22226 - [REG 2.095.1] __ctfe + function call in conditional expression used to initialize struct member in constructor causes ICE (#12995) https://github.com/dlang/dmd/pull/13129
Comment #5 by dlang-bot — 2021-10-08T07:02:42Z
dlang/dmd pull request #13140 "merge stable" was merged into master: - fab4bfe36666f00ea57b4f8c6121fa73b7a9a51b by Boris Carvajal: Fix Issue 22226 - [REG 2.095.1] __ctfe + function call in conditional expression used to initialize struct member in constructor causes ICE (#12995) https://github.com/dlang/dmd/pull/13140