This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH][4.3] Deprecate -ftrapv
Florian Weimer wrote:
* 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
No, it is exactly C, if an arithmetic operation causes overflow
and you do not have -gnato set, and overflow occurs, the program
execution is erroneous. I reread the last para above more than once
but cannot guess what you are getting.
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.
Why is it surprising, if you suppress overflow checks you are saying
that overflow does not occur, just as you say this for *any* C program.
I don't understand the surprise or the concern here, can you
If you think your program might have integer overflow, and
you want to check for this, you must use -gnato.