IBM Support

PI92943: INCORRECT C++ CALLING CONVENTION FOR DEREFERENCED COMPLEX-TYPE STRUCT

A fix is available

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The October 2017 z/OS XL C/C++ V2R2 PTF contained APAR PI88204
    which corrected a C++ calling convention issue for structs
    containing two floating point values (i.e. the 'complex'
    datatype).  The fix corrected the parameter-passing method for
    this type, i.e. via floating point registers instead of general
    purpose registers.
    
    This APAR corrects a similar case where a dereferenced 'complex'
    struct is passed to a function.
    
    
       === TEST CASE ===
    #include <stdio.h>
    
    struct Complex
    {
        double real;
        double imag;
    };
    
    void func( struct Complex t )
    {
        printf( "%10f , %10f \n", t.real, t.imag );
    }
    
    int main( int ac, char *av[] )
    {
        struct Complex st;
        struct Complex *p_st = &st;
        st.real = 1.1;
        st.imag = 2.2;
    
        func( p_st[0] );  // PASSING DEREFERENCED STRUCT
        func( *p_st   );
    
        return 0;
    }
    
    $ xlc++ -q64 -qlist apar.cpp
    
    
       === LISTING ===
    
              func(Complex)
    000009 |        DS       0D
    000009 |        STMG     r5,r9,1736(r4)
    000009 |        LAY      r4,-320(,r4)
    End of Prolog
    
    000000 |        LARL     r9,F'118'
    000009 |        STD      f0,t(,r4,2496)  // LOAD VALUES IN
    000009 |        STD      f2,t(,r4,2504)   // VIA FPRs
    
    
              main()
    000014 |        STMG     r5,r9,1736(r4)
    000014 |        LAY      r4,-320(,r4)
     000114           End of Prolog
    
    000000 |        LARL     r9,F'62'
    ...
    000021 |       *  func( p_st[0]);
    000021 |        LG       r6,p_st(,r4,2240)
    000021 |        LG       r5,#Save_ADA_Ptr_2(,r4,2056)
    000021 |        LG       r1,(Complex)(,r6,0)   // LOAD VALUES IN
    000021 |        LG       r2,(Complex)(,r6,8)    // VIA GPRs
    000021 |        BRAS     r7,func(Complex)
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED: C++ users calling function with homogeneous  *
    *                 float aggregate parameter like 'complex' by  *
    *                 indirecting argument(s).                     *
    ****************************************************************
    * PROBLEM DESCRIPTION: Indirecting argument used general       *
    *                      purpose registers are apposed to        *
    *                      floating registers but the function     *
    *                      was                                     *
    *                      receiving argument via floating point   *
    *                      registers. This caused incorrect        *
    *                      floating point values.                  *
    ****************************************************************
    .
    

Problem conclusion

  • Apply service provided.
    

Temporary fix

Comments

APAR Information

  • APAR number

    PI92943

  • Reported component name

    C/C++ FOR MVS

  • Reported component ID

    56551210A

  • Reported release

    7A0

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2018-01-26

  • Closed date

    2018-02-15

  • Last modified date

    2018-04-04

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

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

    PI96208

Modules/Macros

  • CCNECICS CCNECWI  CCNED220 CCNEDSCT CCNEDWRT CCNEFILT CCNEHIFC
    CCNEMDEP CCNEOPTP CCNEP    CCNEPP   CCNETBY  CCNMSGE  CCNMSGT
    

Fix information

  • Fixed component name

    C/C++ FOR MVS

  • Fixed component ID

    56551210A

Applicable component levels

  • R7A0 PSY UI53925

       UP18/03/15 P F803

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":"7A0","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":"7A0","Edition":"","Line of Business":{"code":"LOB35","label":"Mainframe SW"}}]

Document Information

Modified date:
09 August 2024