> > Right, the code generated by the front end is not pretty either, but at > > least the front-end knows what it is doing Ada-wise. -ftrapv is so dumb > > at the moment that it emits checks for virtually anything. > > No, it just emits it for signed operations.
Of course, it is not so dumb as to blatantly violate its specification. > If we use -ftrapv, then we have to make sure that operations labeled by the > front end as not requiring an overflow check are transformed into unsigned > operations by gigi. I think it would be dangerous to take that path. > I don't see that's so terrible, the jmp will be free in practice anyway > so I don't think you will find this slows things down. You missed the point; the overflow check has been optimized away by one of the RTL optimization passes. -- Eric Botcazou