On Dec 18, 2006, at 9:53 AM, Robert Dewar wrote:
Chris Lattner wrote:
C99 says:
The integer promotions are performed on each of the operands. The
type of the result is
that of the promoted left operand. If the value of the right
operand is negative or is
greater than or equal to the width of the promoted left operand,
the behavior is undefined.
Thus, it is undefined.
So the suggested transformation is indeed valid, which is what I
thought, but some seem to be contesting this, though I don't see
on what grounds.
It only retains the proper semantics when targeting a machine that
zeros the result of oversized left shifts. The original question was
about X86 codegen, which doesn't have this behavior, so it is not valid.
-Chris