unsigned / double propagation weirdness?

Paul Schlie schlie@comcast.net
Tue Feb 24 17:27:00 GMT 2004


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 ...



More information about the Gcc mailing list