Bug 21956 – ice on foreach over an AA of noreturn

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-05-23T03:38:35Z
Last change time
2022-07-12T10:52:20Z
Keywords
backend, pull
Assigned to
No Owner
Creator
Basile-z

Comments

Comment #0 by b2.temp — 2021-05-23T03:38:35Z
this code triggers an assertion in the backend: --- alias noreturn = typeof(*null); noreturn[noreturn] nrnr; int main() { foreach (a; nrnr){} return 0; } --- > dmd: src/dmd/backend/cod4.d:416: Assertion `cast(int)sz > 0' failed. DMD git 9d718f2f8c7f34d3b616791493d9e71d7527f221
Comment #1 by b2.temp — 2021-05-23T03:58:21Z
also triggered by --- alias noreturn = typeof(*null); int main() { noreturn b; noreturn a = b ? b : b; return 0; } ---
Comment #2 by moonlightsentinel — 2021-05-24T16:19:51Z
The code is valid but the backend doesn't support it yet.
Comment #3 by Ajieskola — 2021-10-15T14:31:02Z
I think that a compiler crash that triggers without any preview switches is a critical bug.
Comment #4 by moonlightsentinel — 2022-01-04T12:16:41Z
*** Issue 22650 has been marked as a duplicate of this issue. ***
Comment #5 by dlang-bot — 2022-07-08T10:32:10Z
@RazvanN7 created dlang/dmd pull request #14274 "Fix Issue 21956 - Issue 21956 - ice on foreach over an AA of noreturn" fixing this issue: - Fix Issue 21956 - Issue 21956 - ice on foreach over an AA of noreturn https://github.com/dlang/dmd/pull/14274
Comment #6 by dlang-bot — 2022-07-12T10:52:20Z
dlang/dmd pull request #14274 "Fix Issue 21956 - ice on foreach over an AA of noreturn" was merged into master: - 52bb3f701e18dd393065aa3184f1b8ef4bf5690a by RazvanN7: Fix Issue 21956 - ice on foreach over an AA of noreturn https://github.com/dlang/dmd/pull/14274