https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121936
--- Comment #31 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> --- Correct me if I'm wrong, but the only difference between unspecified behavior and implementation defined behavior is the requirement to document the latter. With implementation defined behavior you can still have different behaviors at different optimization levels, as long as it's documented as such. As soon as any of such choices lead to visible side effects ... yes it seems like that would need to be part of the ABI. We would need to have a different ABI for all different -m flags as well. 🙈 (… which is in part acknowledged by the x86-64-v? "ABIs".) And the math flags … With regard to IPA, I don't think it is helpful for IPA to assume every behavior could be unspecified or implementation-defined and thus be different in a different TU. There's simply not enough of that to warrant this kind of pessimization. Instead, I think we should rather insert an optimization barrier at the places where we want to be compatible with different takes on unspecified/implementation-defined behavior.
