IBM Support

PH70869: C++ EXTERN STORAGE CLASS SPECIFIER NOT AFFECTING FUNCTION TYPEDEF

A fix is available

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The extern "linkage_specification" syntax for defining external
    linkage types is not affecting the linkage mode the C++ compiler
    is using when generating calls to typedef'ed function types.
    Depending on the required linkage type, this may cause undefined
    behaviour or application crashes, particularly when managing
    parameter lists for function calls between Standard OS-style
    linkage and XPLINK.
      ===  TEST CASE  ===
    
    #include <stdlib.h>
    
    extern "OS_UPSTACK"
    
    {
    
       typedef int func_type_with_linkage(const char *);
    }
    
    int main() {
       static func_type_with_linkage *my_function = nullptr;
       my_function = (func_type_with_linkage *)(fetch("BPXWDY2"));
    
       my_function("ALLOC FI(SYSOUT) SYSOUT(X) MSG(2)");
    }
    
    $ ibm-clang++ -m32 -D_EXT apar.cpp -o apar
    

Local fix

  • Refactor the C++ extern declaration into a C-style #pragma
    linkage statement (https://www.ibm.com/docs/en/open-xl-c-cpp-zo
    s/2.2.0?topic=sp-pragma-linkage)
    
    typedef int func_type_with_linkage(const char *);
    
    #pragma linkage (func_type_with_linkage,OS_UPSTACK)
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED: Users with extern"OS" or "OS_UPSTACK"        *
    *                 specified on a typedef for a function type   *
    ****************************************************************
    * PROBLEM DESCRIPTION: Compiler ignores calling convention     *
    *                      specified by 'extern' keyword if it is  *
    *                      specified on a typedef.                 *
    ****************************************************************
    * RECOMMENDATION: Install PTF                                  *
    ****************************************************************
    When constructing the typedef's type, the compiler did not
    consult the pragma linkage specification. Consequently, any
    function later declared with this typedef defaulted
    /to the standard calling convention rather than the linkage
    mandated by the pragma.
    

Problem conclusion

  • The compiler was corrected to register the pragma-specified
    calling convention during creation of the typedef's type.
    Consequently, functions declared using this typedef
    now receive the correct calling convention.
    

Temporary fix

Comments

APAR Information

  • APAR number

    PH70869

  • Reported component name

    C/C++ FOR MVS

  • Reported component ID

    56551210A

  • Reported release

    7C4

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2026-04-13

  • Closed date

    2026-06-29

  • Last modified date

    2026-07-02

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

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

Modules/Macros

  • CNWC001  CNWC002  CNWC003  CNWC004  CNWC005  CNWC006  CNWC007
    CNWC008  CNWC009  CNWC00A  CNWC00B  CNWC00C  CNWC00D  CNWC00E
    CNWC00F  CNWC010  CNWC011  CNWC012  CNWC013  CNWC014  CNWC015
    CNWC016  CNWC017  CNWC018  CNWC019  CNWC01A  CNWC01B  CNWC01C
    CNWC01D  CNWC01E  CNWC01F  CNWC020  CNWC021  CNWC022  CNWC023
    CNWC024  CNWC025  CNWC026  CNWCH006 CNWCH00A CNWCH00B CNWLDMD
    CNWOX220 CNWPH0B3 CNWPH107 CNWPH146 CNWPH20D CNWPH2E3 CNWPH31E
    CNWPH334 CNWPH446 CNWPH55F CNWPH673 CNWPHPAX CNWRN$P0 CNWRN$PX
    CNWRNH00 CNWRNH01 CNWRNH02 CNWRNH03 CNWRNH04 CNWRNH05 CNWRNH06
    CNWRNH07 CNWRNH08 CNWRNH09 CNWRNH0A CNWRNH0B CNWRNH0C CNWRNH0D
    CNWRNH0E CNWRNH0F CNWRNH10 CNWRNH11 CNWRNH12 CNWRNH13 CNWRNH14
    CNWRNH15 CNWRNH16 CNWRNH17 CNWRNH18 CNWRNH19 CNWRNH1A CNWRNH1B
    CNWRNH1C CNWRNH1D CNWRNH1E CNWRNH1F CNWRNH20 CNWRNH21 CNWRNH22
    CNWRNH23 CNWRNH24 CNWRNH25 CNWRNH26 CNWRNH27 CNWRNH28 CNWRNH29
    CNWRNH2A CNWRNH2B CNWRNH2C CNWRNH2D CNWRNH2E CNWRNH2F CNWRNH30
    CNWRNH31 CNWRNH32 CNWRNH33 CNWRNH34 CNWRNH35 CNWRNH36 CNWRNH37
    CNWRNH38 CNWRNH39 CNWRNH3A CNWRNH3B CNWRNH3C CNWRNH3D CNWRNH3E
    CNWRNH3F CNWRNH40 CNWRNH41 CNWRNH42 CNWRNH43 CNWRNH44 CNWRNH45
    CNWRNH46 CNWRNH47 CNWRNH48 CNWRNH49 CNWRNH4A CNWRNH4B CNWRNH4C
    CNWRNH4D CNWRNH4E CNWRNH4F CNWRNH50 CNWRNH51 CNWRNH52 CNWRNH53
    CNWRNH54 CNWRNH55 CNWRNH56 CNWRNH57 CNWRNH58 CNWRNH59 CNWRNH5A
    CNWRNH5B CNWRNH5C CNWRNH5D CNWRNH5E CNWRNH5F CNWRNH60 CNWRNH61
    CNWRNH62 CNWRNH63 CNWRNH64 CNWRNH65 CNWRNH66 CNWRNH67 CNWRNH68
    CNWRNH69 CNWRNH6A CNWRNH6B CNWRNH6C CNWRNH6D CNWRNH6E CNWRNH6F
    CNWRNH70 CNWRNH71 CNWRNH72 CNWRNH73 CNWRNH74 CNWRNH75 CNWRNH76
    CNWRNH77 CNWRNH78 CNWRNH79 CNWRNH7A CNWRNH7B CNWRNH7C CNWRNH7D
    CNWRNH7E CNWRNH7F CNWRNH80 CNWRNH81 CNWRNH82 CNWRNH83 CNWRNH84
    CNWRNH85 CNWRNH86 CNWRNH87 CNWRNH88 CNWRNH89 CNWRNH8A CNWRNH8B
    CNWRNH8C CNWRNH8D CNWRNH8E CNWRNH8F CNWRNH90 CNWRNH91 CNWRNH92
    CNWRNH93 CNWRNH94 CNWRNH95 CNWRNH96 CNWRNH99 CNWRNH9A CNWRNH9B
    CNWRNH9C CNWRNH9D CNWRNH9E CNWRNH9F CNWRNHA0 CNWRNHA1 CNWRNHA2
    CNWRNHA3 CNWRNHA4 CNWRNHA5 CNWRNHA6 CNWRNHA7 CNWRNHA8 CNWRNHA9
    CNWRNHAB CNWRNHAC CNWRNHAD CNWRNHAE CNWRNHAF CNWRNHB0 CNWRNHB1
    CNWRNHB2 CNWRNHB3 CNWRNHB4 CNWRNHB5 CNWRNHB6 CNWRNHB7 CNWRNN00
    CNWRNN01 CNWRNN02 CNWRNN03 CNWRNN04 CNWRNN05 CNWRNN06 CNWRNN07
    

Fix information

  • Fixed component name

    C/C++ FOR MVS

  • Fixed component ID

    56551210A

Applicable component levels

  • R7C4 PSY UO07991

       UP26/07/02 P F606

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":"SSTLTF","label":"z\/OS XL C\/C++"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7C4","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
02 July 2026