[PATCH][4.3] Deprecate -ftrapv

Florian Weimer fw@deneb.enyo.de
Sat Mar 1 19:53:00 GMT 2008


* Robert Dewar:

> So here's exactly what happens now in Ada
>
> 1. If -gnato is not set (no overflow checking)
>
> In this case, the situation is exactly the same as C, and the front end
> ignores the possibility of overflow.

It's C in -fwrapv mode, isn't it?  (Otherwise, you can't really get the
other constraint checks to work, including bounds checking for array
access.)

> The official Ada semantics are that if you suppress overflow checks,
> and an overflow occurs (intermediate or otherwise), the executino is
> erroneous (undefined in C-speak). So Ada with checks off is in all
> respects identical to C semantics. No problem.

Uh-oh, this is really, really surprising.



More information about the Gcc-patches mailing list