Paul Schlie wrote:
- So technically as such semantics are undefined, attempting to track and identify such ambiguities is helpful; however the compiler should always optimize based on the true semantics of the target, which is what the undefined semantics truly enable (as pretending a target's semantics are different than the optimization assumptions, or forcing post-fact run-time trapping semantics, are both useless and potentially worse, inefficient and/or erroneous otherwise).
The first part of this is contentious, but arguable certainly (what is useful behavior). There is certainly no requirement that the semantics should match that of the target, especially since that's ill-defined anyway (for targets that have many different kinds of arithemetic instructions). The second part is wrong, it is clear that there are cases where the quality of code can be improved by really taking advantage of the undefinedness of integer overflow.