IBM Support

PI50494: INCORRECT OUTPUT WHEN READING FROM A FILE

A fix is available

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When compiling with OPT, the exe doesn't produce the correct
    output when reading from a file. The source snippet that shows
    the incorrect output is as follows:
    
    The error is in the following coding marked with ">>"
    --------------------------------------------------------------
    while(ll)
      {
        ll = maxbuflen;
        clear(InBuffer);
        ll = fread(InBuffer, 1, ll, fpFileD431);
        if(!ll)               // EOF
          {
            break;
          }
        InCnt++;
        printf("InCnt=<%d>, ll=<%d>, InBuffer=<%.10s>\n",
                                     InCnt, ll, InBuffer);
        fflush(NULL);
    >>  printf("InCnt=<%d>\n", InCnt);   (add. line in old compiler)
    >>  if(InCnt > 6)
    >>    {
    >>      printf("InCnt > 6: InBuffer=<%10.10s>\n", InBuffer
            fflush(NULL);
            if(ll < 16)
            {
              InBuffer[ll] = '\0';  // convert to string
              printf("ll < 16: InBuffer=<%10.10s>\n", InBuffer);
              fflush(NULL);
              TmpFooter = atoi(InBuffer) - 6; // remember BK NLB
    Footer
              rc = string2decimal(&nFooter,sizeof(nFooter),
                                  InBuffer, strlen(InBuffer));
              nFooter -= 7;  // correcting, 5*header,1 headline,1
    Footer
              footer++;      // because correction (empty file)
    #DN001
              break;
            }
          }
      } // while(ll)
    -----------------------------------------------------------
    
    ===== ACTUAL OUTPUT:
    $ ./a.out
    Start ReadD431
    ICBTGTST: InCnt=1
    ICBTGTST: InCnt=2
    ICBTGTST: InCnt=3
    ICBTGTST: InCnt=4
    ICBTGTST: InCnt=5
    ICBTGTST: InCnt=6
    ICBTGTST: InCnt=7
    ICBTGTST: Muss wenn InCnt>6 immer kommen.=7
    ICBTGTST: InCnt=8
    ICBTGTST: InCnt=9
    ICBTGTST: InCnt=10
    ICBTGTST: InCnt=11
    ICBTGTST: InCnt=12
    ICBTGTST: InCnt=13
    ICBTGTST: InCnt=14
    ICBTGTST: InCnt=15
    ICBTGTST: InCnt=16
    ICBTGTST: InCnt=17
    ICBTGTST: InCnt=18
    ICBTGTST: InCnt=19
    ## ICBTGTST: Kein Footer es erfolgt abbruch.
    Ende  ReadD431!
    $
    
    
    ===== EXPECTED OUTPUT:
    $ ./a.out
    Start ReadD431
    ICBTGTST: InCnt=1
    ICBTGTST: InCnt=2
    ICBTGTST: InCnt=3
    ICBTGTST: InCnt=4
    ICBTGTST: InCnt=5
    ICBTGTST: InCnt=6
    ICBTGTST: InCnt=7
    ICBTGTST: Muss wenn InCnt>6 immer kommen.=7
    ICBTGTST: InCnt=8
    ICBTGTST: Muss wenn InCnt>6 immer kommen.=8
    ICBTGTST: InCnt=9
    ICBTGTST: Muss wenn InCnt>6 immer kommen.=9
    ICBTGTST: InCnt=10
    ICBTGTST: Muss wenn InCnt>6 immer kommen.=10
    ICBTGTST: InCnt=11
    ICBTGTST: Muss wenn InCnt>6 immer kommen.=11
    ICBTGTST: InCnt=12
    ICBTGTST: Muss wenn InCnt>6 immer kommen.=12
    ICBTGTST: InCnt=13
    ICBTGTST: Muss wenn InCnt>6 immer kommen.=13
    ICBTGTST: InCnt=14
    ICBTGTST: Muss wenn InCnt>6 immer kommen.=14
    ICBTGTST: InCnt=15
    ICBTGTST: Muss wenn InCnt>6 immer kommen.=15
    ICBTGTST: InCnt=16
    ICBTGTST: Muss wenn InCnt>6 immer kommen.=16
    ICBTGTST: InCnt=17
    ICBTGTST: Muss wenn InCnt>6 immer kommen.=17
    ICBTGTST: InCnt=18
    ICBTGTST: Muss wenn InCnt>6 immer kommen.=18
    Ende  ReadD431!
    $
    

Local fix

  • N/A
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED: zOS XLC users with source compiled at OPT    *
    *                 with opportunities for branch folding        *
    ****************************************************************
    * PROBLEM DESCRIPTION: After a branch was folded and the       *
    *                      condition to the label removed the      *
    *                      label indicator bit was not updated to  *
    *                      reflect it being unguarded, therefore   *
    *                      setting up another optimization down    *
    *                      the stream to make an incorrect         *
    *                      assumption and transform the code       *
    *                      incorrectly.                            *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    

Problem conclusion

  • Apply provided service.
    

Temporary fix

Comments

APAR Information

  • APAR number

    PI50494

  • Reported component name

    C/C++ FOR MVS

  • Reported component ID

    56551210A

  • Reported release

    791

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2015-10-13

  • Closed date

    2015-10-14

  • Last modified date

    2016-06-04

  • APAR is sysrouted FROM one or more of the following:

    PI36266

  • APAR is sysrouted TO one or more of the following:

Modules/Macros

  •    CCNETBY
    

Fix information

  • Fixed component name

    C/C++ FOR MVS

  • Fixed component ID

    56551210A

Applicable component levels

  • R791 PSY UI32071

       UP15/11/21 P F511

Fix is available

  • Select the PTF appropriate for your component level. You will be required to sign in. Distribution on physical media is not available in all countries.

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SG19M","label":"APARs - z\/OS environment"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"791","Edition":"","Line of Business":{"code":"","label":""}},{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSQKCWV","label":"IBM C\/C++ for MVS\/ESA"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"791","Edition":"","Line of Business":{"code":"LOB35","label":"Mainframe SW"}}]

Document Information

Modified date:
22 August 2024