IBM Support

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

Subscribe to this APAR

By subscribing, you receive periodic emails alerting you to the status of the APAR, along with a link to the fix after it becomes available. You can track this item individually or track all items by product.

Notify me when this APAR changes.

Notify me when an APAR for this component changes.

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



Document information

More support for: XL C for AIX
Compiler

Software version: D13

Reference #: IJ08152

Modified date: 02 August 2018