This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Ada front-end depends on signed overflow
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: Paul Schlie <schlie at comcast dot net>
- Cc: Andrew Pinski <pinskia at physics dot uc dot edu>, GCC List <gcc at gcc dot gnu dot org>, <bosch at gnat dot com>
- Date: Fri, 03 Jun 2005 18:01:33 +0200
- Subject: Re: Ada front-end depends on signed overflow
- References: <BEC5F0DC.A5D5%schlie@comcast.net>
* Paul Schlie:
>> No they should be using -ftrapv instead which traps on overflow and then
>> make sure they are not trapping when testing.
>
> - why? what language or who's code/target ever expects such a behavior?
I think Andrew wants programmers to fix their code, instead of
papering over problems. 8-)
All code has seen wide testing essentially with -fwrapv enabled
because in previous GCC version, -fwrapv had only a limited effect,
especially across multiple statmeents. That's why I don't prefer the
-ftrapv approach, even though its technically the correct one.
It's a real pity that we have to trust so much C code which has been
written and reviewed by developers who aren't aware that signed
integer overflow is undefined.