# Switch Statements and Stack Overflows

**URL:** <https://forums.swift.org/t/switch-statements-and-stack-overflows/78973>\
**Category:** Using Swift\
**Created:** [March 31, 2025, 5:50pm UTC](https://forums.swift.org/t/switch-statements-and-stack-overflows/78973 "2025-03-31T17:50:59Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![Jumhyn](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jumhyn/32/3891_2.png) [@Jumhyn](https://forums.swift.org/u/Jumhyn)\
**Post date:** [October 14, 2025, 7:18pm UTC](https://forums.swift.org/t/switch-statements-and-stack-overflows/78973/10 "2025-10-14T19:18:55Z")

</div>

Poking this just to say that for a particularly large and slowly growing enum in our codebase we've recently started hitting this issue where `__derived_enum_equals(_:_:)` consumes essentially the entire stack allocated to a cooperative thread pool thread. This means that when we compare two of these enum values in any test, we are at severe risk of exhausting the stack even if there's very little else going on. Would be very nice to have a solution for this in debug builds!

---

_[View the full topic](https://forums.swift.org/t/switch-statements-and-stack-overflows/78973)._
