4 ms·
All optimizations rely on the assumption that things have well-defined semantics. Even something like rewriting 1+1 into 2 is only valid if you assume that no o
by plorkyeran 3y ago
All optimizations rely on the assumption that things have well-defined semantics. Even something like rewriting 1+1 into 2 is only valid if you assume that no one is going to patch your executable code to replace the add with a multiply. The concept of an optimizer that does not make any assumptions is just nonsense.
There’s a lot of very reasonable assumptions that compilers make and some less reasonable ones, but there is no clean line between the two. Ideally the standard would have clearly specified what assumptions compilers could make, but this whole thing is the result of GCC following their interpretation of what the standard says they can do and people not liking the result.