IBM Support

IJ08152: BAD CAST CAUSING INCORRECT AIX _LARGE_FILES TELLG() VALUE

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When compiling with large file support, a bad cast within the
    C++ runtime is causing bad values from the fstream tellg()
    function.
    
    With large file support, 'long long' types are the main datatype
    for managing the large size of the file.  When tellg() is called
    it relies on a macro called _FPOSOFF in <yvals.h> that does a
    cast to long, instead of long long.  This bad cast cascades back
    to the 'pos_type'/''streampos' returned by tellg(), which gives
    an incorrect value.
    
    
    
       === TEST CASE ===
    
    #include<iostream>
    #include<fstream>
    
    std::fstream fs("file", std::ios_base::in);
     // Where 'file' is a large file
    
    int main()
    {
     using namespace std;
    
     fs.seekg(0, std::ios_base::end);
     cout << "tellg() =            " << fs.tellg() << endl;
     cout << "(uint32_t)tellg() =  " << (uint32_t)fs.tellg() <<endl;
    };
    
    
    OUPUT:
    $ xlC -qlonglong -D_LARGE_FILES apar.cpp
    $ ./a.out
    tellg() =            -562486541
    (uint32_t)tellg() =  3732480755
    $
    
    EXPECTED OUTPUT:
    $ xlC -qlonglong -D_LARGE_FILES apar.cpp
    $ ./a.out
    tellg() =            3732480755
    (uint32_t)tellg() =  3732480755
    $
    

Local fix

  • Cast return value of tellg() to uint32_t
    

Problem summary

  • PROBLEM DESCRIPTION:
    When compiling with large file support on AIX, a bad cast
    within the C++ runtime is causing bad values from the fstream
    tellg() function.
    
    USERS AFFECTED:
    User who use the file-based stream library (fstream) with large
    file support.
    

Problem conclusion

  • Please apply the fix if you are using large file support along
    with the file-based stream library.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IJ08152

  • Reported component name

    XL C FOR AIX

  • Reported component ID

    5725C7100

  • Reported release

    D13

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2018-08-02

  • Closed date

    2018-08-02

  • Last modified date

    2018-08-02

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

    IV95280

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

Fix information

  • Fixed component name

    XL C FOR AIX

  • Fixed component ID

    5725C7100

Applicable component levels

[{"Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSGH2K","label":"XL C for AIX"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"D13"}]

Document Information

Modified date:
24 August 2021