|
|
|
|
|
by haberman
1296 days ago
|
|
I don't think this is correct. If UB is never invoked, the program is conforming and must be translated/executed correctly. DR #109 specifically states that a compiler may not fail to translate a strictly conforming program just because some possible executions could trigger UB: https://www.open-std.org/jtc1/sc22/wg14/docs/rr/dr_109.html Edit: downvoters, please explain your disagreement. I cited a primary document in support of my position. |
|
It's just that the generated code may not do exactly what you expect it to do because the presence of undefined behavior allowed the compiler to make assumptions which may surprise you.
edit: It seems that I am incorrect