Security quotes of the week
Security quotes of the week
Posted May 3, 2018 20:37 UTC (Thu) by nix (subscriber, #2304)In reply to: Security quotes of the week by jwakely
Parent article: Security quotes of the week
... but of course this may not prevent the compiler biting you in the arse if you rely on undefined behaviour. Optimization isn't some special magic: it's just doing stuff during translation, and the compiler is quite within its rights to assume that the program is not invoking undefined behaviour in passes other than those that happen to be part of the optimizer. (And it does.)
People who assume that -O0 makes GCC into some sort of "translate the input into the output no matter what undefined stuff we do" machine are operating under a false assumption. No such magic machine exists (nor can it). It appears that what they actually want is a compiler that knows what undefined things they in particular are doing, and does the right thing in those cases. (Good luck with that.)
