This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: signed is undefined and has been since 1992 (in GCC)
- From: Michael Veksler <VEKSLER at il dot ibm dot com>
- To: Steven Bosscher <stevenb at suse dot de>
- Cc: gcc at gcc dot gnu dot org, Gabriel Dos Reis <gdr at integrable-solutions dot net>, Andrew Pinski <pinskia at physics dot uc dot edu>
- Date: Tue, 28 Jun 2005 10:19:35 +0300
- Subject: Re: signed is undefined and has been since 1992 (in GCC)
Steven Bosscher wrote on 28/06/2005 09:55:03:
> On Tuesday 28 June 2005 07:12, Gabriel Dos Reis wrote:
> > For the concrete case at issue, if the hardware I'm writing the C/C++
> > programs for consistently displays modulo arithmetics for signed
> > integer type, Andrew can you tell me why GCC should deny me access
> > to that functionally where it actually can?
>
> Because it disallows compiler transformations? E.g. suddenly a
> loop with a signed variable as the loop counter may wrap around,
> which that means some transformations that are safe now would
> no longer be safe.
So maybe introduce a -fsigned-wraps flag, that the user can use
to make 'int' wrap even in loops. We have -fstrict-aliasing, so why
not have -fsigned-wraps for users who want it. This way everybody
will be happy (Gaby and Andrew in particular).
I don't care either way, as long as numeric_limits is consistent.
Michael