Is an infinite loop like for (;;); undefined behavior in C? (It is for C++, but I don\'t know about C.)
The rationale for this question with relevance to C++ isn't relevant to C. Section 5.1.2.3p6 states the limits to optimisation, and one of them is:
At program termination, all data written into files shall be identical to the result that execution of the program according to the abstract semantics would have produced.
Now the question becomes "What data would execution according to the abstract semantics have produced?". Assuming a signal interrupts the loop, the program may very well terminate. The abstract semantics would have produced no output prior to that signal being raised, however. If anything, the compiler may optimise the puts("Hello"); away.