But a function blocking indefinitely while repeatedly writing to a volatile variable is well-defined.
So the compiler cannot remove a function call followed by UB unless it knows that the function won't do that.
In theory, the compiler could know that since `printf` is a well-known standard function. In practice, `printf` might even exit the program via SIGPIPE, so I don't think any compiler will assume that it definitely will return.