Laurent GUERBY wrote:
I don't think so. And the code quality when checking for
overflows was abysmal last time I tried.
We're talking about range checking here, not arithmetic overflow
checking (which is another topic where GCC infrastructure change
could help Ada of course).
Actually in terms of the thread (infinitely ranged integer model),
you are clearly to me talking about both, so you need to look at
the Ada model with overflow checks enabled (or GNAT with the
-gnato flag set).
BTW, the history is interesting here. The back end has never had
good support for overflow checking for integers (I keep getting
told that -ftrapv doesn't work, and in any case 15 years ago it
was not there).
So I implemented a temporary junk circuit to do the overflow
checking required by the standard (usually it works by using
double length arithmetic followed by a range check). It was
indeed nasty and intended to be temporary, which is why it is
still not on by default.
Recently however, Geert did a major renovation of overflow
checking and already it is much more efficient. Continued
improvements in the area of range/overflow checking that
are being worked on now will further improve matters and
greatly reduce the overhead from run time checking in GNAT.
We will probably make -gnato the default once this work
is complete, depending on how efficiency tests work out.
Robert