This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: unsigned / double propagation weirdness?
- From: Paul Schlie <schlie at comcast dot net>
- To: <gcc at gcc dot gnu dot org>
- Date: Tue, 24 Feb 2004 12:15:19 -0500
- Subject: Re: unsigned / double propagation weirdness?
I would have expected the opposite; as an un-widened unsigned arithmetically
negated operand may not be correctly arithmetically represented in a signed
un-widened operation, however will be in a widened operation; which is what
I perceive the warning message is properly indicating.
(Arithmetic operations which may yield implementation precision
dependant results, should likely generate warnings, unless the
operation explicitly uses appropriate casts to indicate intent.)
-paul-
> Robert Dewar wrote:
>> Joe Buck wrote:
>> So the warning would only be generated if an unsigned negation is
>> widened (or potentially widened, in the case of conversions to long,
>> to alert the programmer to portability issues).
>>
>> This should eliminate Robert's concerns about intentional use of -
>> for two's complement: in such cases, the result would not be widened.
>
> Yes, that sounds right, although I wonder how common this case is ...