This is an example to illustrate my question which involves some much more complicated code that I can\'t post here.
#include
int main()
{
First, let me correct the title of this question:
Undefined Behavior is not (specifically) of the realm of execution.
Undefined Behavior affects all steps: compiling, linking, loading and executing.
Some examples to cement this, bear in mind that no section is exhaustive:
LD_PRELOAD tricks on UnixesThis is what is so scary about Undefined Behavior: it is nigh impossible to predict, ahead of time, what exact behavior will occur, and this prediction has to be revisited at each update of the toolchain, underlying OS, ...
I recommend watching this video by Michael Spencer (LLVM Developer): CppCon 2016: My Little Optimizer: Undefined Behavior is Magic.