• No replies
62 Posts

Pinned topic Bug z/OS 2.1 compiler optimizing using ARCH(3)

‏2014-03-28T06:53:46Z |

I ran into a bug with the z/Os 2.1 compiler optimizing C code with the ARCH(3) compiler option. OK, ARCH(3) is clearly not a good idea but the option was hard coded in a build script.

Using the 1.13 compiler a for loop decrements a counter until it reaches zero using an SL instruction and a BNH. This is correct.

 0049A6  5FF0  3692        000757 |                 SL       r15,=F'1'
 0049AA  5010  D0E4        000000 |                 ST       r1,#SPILL5(,r13,228)
 0049AE  5000  D0E0        000757 |                 ST       r0,#SPILL4(,r13,224)
 0049B2  50F0  D0E8        000757 |                 ST       r15,#SPILL6(,r13,232)
 0049B6  47D0  30E8        000757 |                 BNH      @27L452

Using the 2.1 compiler, the counter is decremented using a AHI instruction and tested using BNH. This is wrong.

 004B76  A75A  FFFF        000757 |                 AHI      r5,H'-1'
 004B7A  5050  D0EC        000757 |                 ST       r5,#SPILL7(,r13,236)
 004B7E  41F0  F03C        000000 |                 LA       r15,#AMNESIA(,r15,60)
 004B82  50F0  D0E8        000000 |                 ST       r15,#SPILL6(,r13,232)
 004B86  47D0  30EC        000757 |                 BNH      @27L452


  • Visda
    32 Posts

    Re: Bug z/OS 2.1 compiler optimizing using ARCH(3)


    The fix for this bug is in the April PTF of 2.1 if it is not already in the December PTF.