maxStkSize can overflow
maxStkSize field of
GC_FLAGS is a
unsigned int. It's measured in words, but still 32G is not an unreasonable amount of memory by today's standards.
Maybe it's unlikely that anyone would want to set the stack size limit to more than 32G. But if you happen to have just over 40G of physical memory then the default stack size limit will overflow to a value just above zero and then Bad Things would happen.
If we want to actually enforce stack limits that are greater than 2^32^ words, we would need to increase the size of the
tot_stack_size field of a TSO also.
Simple test of overflow behavior:
ghci +RTS -K32.0001G will exit with a stack overflow.