On Sep 14, 2010, at 18:14, robin wrote:

> From: "Paul Gilmartin" <[email protected]>
> Sent: Sunday, 12 September 2010 4:57 PM
>
>> Another test:
>>
>>  Active Usings: None
>>  Loc  Object Code    Addr1 Addr2  Stmt   Source Statement
>> 000000                00000 00004     1 NEGDISP  CSECT
>>                                      2 *
>>                 R:1 FFFFF0           3          USING X'7FFFFFF0',R1
>> 000000 4132 1020            00010     4          LA    R3,-X'7FFFFFF0'(R2)
>
> Did I miss something here?
> Should the displacement in the object code be x'010', not x'020' ?

x'020' is at least more correct than x'010'.  In decimal:

    -(2**31-16) - (2**31-16) = -2**32 + 32 = x'...FF00000020'

This is an overflow, not reported by HLASM, which takes the lowest
32 bits; observes that it's within displacement range, and uses
the lowest 12 bits as the displacement: x'020'.

The result is correct modulo 2**24 and modulo 2**31, but incorrect
in 64-bit addressing.  Disregarding modulo arithmetic, the result
is mathematically incorrect.  I'd be happier if HLASM detected
the overflow and reported Addressability Error.

-- gil

Reply via email to