4 ms·
The behavior is hostile and dangerous, but legal. If undefined behavior would happen during an execution of a program, then that entire execution of the progra
by souprock 6y ago
The behavior is hostile and dangerous, but legal.
If undefined behavior would happen during an execution of a program, then that entire execution of the program is undefined behavior from the start.
Since all possible executions of this program will lead to undefined behavior, the compiler was free to emit any other program. It is permitted to get rid of all the code. You could say that Clang 13 missed an optimization opportunity here. It could have produced an empty file.
- jart 6y agoObligatory Meme: https://justine.lol/undefined.png https://justine.lol/undefined.png