This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]