Mark Mitchell wrote:
However, I don't think doing all of that work is required to make this feature useful to people. You seem to be focusing on making -ftrapv capture 100% of overflows, so that people could depend on their programs crashing if they had an overflow. That might be useful in two circumstances: (a) getting bugs out (though for an example like the one above, I can well imagine many people not considering that a bug worth fixing), and (b) in safety-critical situations where it's better to die than do the wrong thing.
I don't agree with this list, first it misses (c) be useful for Ada conformance, where 100% of cases must be caught Second, generally speaking in safety-critical systems, you don't want overflow checking, because a) it would generate deactivated code intefering with certification b) in sc code, you have to make sure a priori that there are no overflows (see http://www.praxis-cs.com/pdfs/Industrial_strength.pdf for one approach). c) exceptions can be safety hazards if you don't carefully consider what to do with them (think about Ariane 5). So for me, the two uses of -ftrapv are debugging in languages like C and Fortran, and for debugging and language conformance in languages like Ada. Certainly for the debugging use, a solution that is not 100% is still useful.