Bug 22390 – Compiler crash when iterating empty array of bottom types

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-10-15T14:25:04Z
Last change time
2022-07-15T09:32:03Z
Keywords
backend, pull
Assigned to
No Owner
Creator
Ate Eskola

Comments

Comment #0 by Ajieskola — 2021-10-15T14:25:04Z
These both cause a compiler crash on latest master: --- int main() { noreturn[] empty; int val; foreach(el; empty) val++; return val; } --- --- int main() { noreturn[] empty; return empty == empty; } --- Also tested the latter on 2.097.2, which crashes too. Issue 21956 is likely to be related.
Comment #1 by moonlightsentinel — 2021-10-16T16:05:21Z
The first example is a duplicate of issue 21956. The second one is new and manifests in an assertion failure: dmd: src/dmd/backend/cod3.d:2400: Assertion `0' failed.
Comment #2 by dlang-bot — 2022-07-12T10:10:31Z
@RazvanN7 created dlang/dmd pull request #14294 "Fix Issue 22390 - Compiler crash when iterating empty array of bottom types" fixing this issue: - Fix Issue 22390 - Compiler crash when iterating empty array of bottom types https://github.com/dlang/dmd/pull/14294
Comment #3 by dlang-bot — 2022-07-15T09:32:03Z
dlang/dmd pull request #14294 "Fix Issue 22390 - Compiler crash when iterating empty array of bottom types" was merged into master: - c0016fff436473364453c6969459bc58e37f53f2 by RazvanN7: Fix Issue 22390 - Compiler crash when iterating empty array of bottom types https://github.com/dlang/dmd/pull/14294