On Wed, 22 Apr 2009 13:36:13 -0400, Thomas David Rivers wrote:
>Johnny Luo wrote:
>> Hi,
>>
>> I was trying new METAL option of XL C and the following is the HLASM code
>> generated :
>>
>> * {
>> * char a[20]="12345";
>> MVC 88(6,13),0(11)
Is that the actual initialization, in which case the next 4
instructions are incomprehensible?
>> MVI @74a+6,0
>> MVC @74a+7(13),@74a+6
>> MVI @74a+6,0
>> MVC @74a+7(13),@74a+6
>> * return;
>> * }
>>
I wouldn't expect it to move 13 characters to assign a 5-character
(well, 6, counting the terminating NUL) in a 20-character buffer.
>> It initialized the buffer twice! I cannot think of why. Is it normal?
>>
>>
>Not to point too many fingers, but since we did it first,
>here's what Systems/C did with Johnny's example:
>
>* *
>* *** char a[20]="12345";
> LA 14,@lit_6_0
> MVC 96(6,13),0(14)
Wouldn't it work to:
MVC 96(6,13),@lit_6_0
...? If the LA works you have addressability. Yah, I know;
I've worked with (simple) code generators. I probably don't
understand the environmental constraints. Perhaps as simple
as the optimizer detected a need for R14 subsequently.
>* setting 14 bytes to 0x00
> XC 102(14,13),102(13)
>
You're only trying to help the programmer, but perhaps thereby
thwarting the intent of a deliberate Dirty GETMAIN.
>* *** return;
>* *** }
-- gil
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html