[Default] On 11 Mar 2021 11:52:56 -0800, in bit.listserv.ibm-main [email protected] (Frank Swarbrick) wrote:
>We recently applied patches up through September 2020 to our Enterprise COBOL >V6.2 compiler. Prior to this we had patches through September 2019. This >appears to have changed how some code is generate, even though the compiler >options have not changed. > >Take the following example: > > 01 ipt. > 05 as-char pic xx. > 88 as-char-10 value '10'. > 05 as-nums redefines as-char > pic 99. > 88 as-num-10 value 10. > >Code checking the as-num-10 condition is generating the following code with >the "current" patch level: If as-nums is PIC 99 and not PIC S99, the generated code is flat out wrong. The field can only be x'F1F0" and x'F1C0' would be in error. Clark Morris > >COBOL V6.2 NUMPROC(NOPFD) ZONEDATA(MIG) > >000021: 002200 if as-num-10 > 0001C8 F211 D138 9018 000021 PACK 312(2,R13),24(2,R9) > # AS-NUMS > 0001CE F911 D138 31EC 000021 CP 312(2,R13),492(2,R3) > # +492 > 0001D4 A764 0016 000021 JNE L0006 > >This causes a situation where if "as-nums" is not a valid zoned-decimal field >it's causing a data exception (S0C7) on the CP instruction. >While acknowledging that the code is "bad", or the data is bad (depending on >how you look at it), we're still wondering what changed with the recent >patches. > >While I can't (easily) recover the compiler to the previous level, I did test >with our COBOL V5.2 compiler, which is out of service and did not receive any >recent patches. The same code compiles to this: > >COBOL V5.2 NUMPROC(NOPFD) ZONEDATA(MIG) > >000021: 002200 if as-num-10 > 00019E E300 8028 0095 000021 LLH R0,40(,R8) > # AS-NUMS > 0001A4 C00D FFFF F0F0 000021 OILF R0,X'FFFFF0F0' > 0001AA A70E F1F0 000021 CHI R0,0xf1f0 > 0001AE A764 000C 000021 JNE L0007 > >My guess is that prior to the patches COBOL V6.2 would have done something >similar. As you can see, it's using a CHI instead of a CP, and thus no S0C7. >It seems like V6.2 should not have changed its behavior in this regard. >Thoughts? Is this a new "bug" in COBOL V6.2? > >Frank > >---------------------------------------------------------------------- >For IBM-MAIN subscribe / signoff / archive access instructions, >send email to [email protected] with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
