There are lots of things that happen when a program runs that a compiler is unaware of. A compilers don't run during runtime... So I am confused what you mean by mis-compilations.
As for runtime this is why people follow an ABI. Otherwise lots of things like dynamic linking ect... would not work.