3 ms·
The optimizer isn't required to eliminate code paths encountering dynamic UB; it is allowed to. It also doesn't have to be consistent in its "assumptions", alth
by firethief 8y ago
The optimizer isn't required to eliminate code paths encountering dynamic UB; it is allowed to. It also doesn't have to be consistent in its "assumptions", although inconsistency may be a sign of missing efficiency somewhere
- metaphor 8y ago> The optimizer isn't required to eliminate code paths encountering dynamic UB; it is allowed to. If I understood correctly, Linus had some colorful thoughts[1] on that: If you know something is undefined, you warn about it. You don't silently generate random code that doesn't match the source code just because some paper standard says you "can". [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89501#c12 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89501#c12