6 ms·
> 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
by 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