I'm also confused that an uncalled function is even compiled and linked, wouldn't it make sense to remove it entirely if the compiler can detect that it's never called?
This is literally the opposite behaviour compared to what is written in the source code, even when you "assume the infinite loop terminates".