is there any word processing software for the pdp11?
Jon Elson
elson at pico-systems.com
Thu Dec 4 21:12:38 CST 2014
On 12/04/2014 03:50 PM, Peter Corlett wrote:
> On Tue, Dec 02, 2014 at 03:32:38PM -0800, Fred Cisin wrote:
>> . . .
>>>>> long long int A;
>>>>> int B;
>>>>> A = B << 32;
> [...]
>> So, should the compiler optimize that to
>> MOV X,0
>> or
>> NOP
>> ?
> That basically depends on what "long long" and "int" means :)
>
> The C99 (draft) standard says of << and >> that "[t]he behavior is undefined if
> the right operand is negative, or greater than or equal to the length in bits
> of the promoted left operand"
Well, that's the problem! The destination was 64 bits, the
operand was 32 bits.
if the 32-bit operand got promoted to 64-bits, it would have
worked as the
original programmer intended. But, the whole operation was
done at 32 bits,
and the desired bits fell off the end. I thought that C did
NOT promote smaller
operands, so the behavior was actually expected, once I saw
what was really
going on there.
Jon
More information about the cctalk
mailing list