IBM Support

PI96691: 1-BYTE ENUM SAVED IN INCORRECT OS64_NOSTACK LINKAGE PARAMETER LIST POSITION AFTER OPTIMIZATION

A fix is available

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When calling an external function that uses
    OS_NOSTACK/OS64_NOSTACK linkage, an issue is encountered with
    the parameter list for a 1-byte enum value, when optimization is
    used.
    
    When no optimization is used, the parameter list temp value for
    the 1-byte enum is correct - i.e. the value is loaded, then
    stored into a temp area as a full 32-bit value, per the #pragma
    linkage documentation:
    
       #pragma linkage (C only)
       https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.2.0/
       com.ibm.zos.v2r1.cbclx01/zos_pragma_linkage.htm
    
          OS_NOSTACK
          For integer type arguments, the value passed is widened
          to the size of the int type, that is 4-byte.
    
    The code appears as:
    
    000B6  E300  7008  0090  000019  | LLGC
                                r0,(*)mystruct.mystruct.val(,r7,8)
    0000BC  5000  48C0       000019 | ST r0,#wtemp_1(,r4,2240)
    0000C0  4100  48C0       000019 | LA r0,#wtemp_1(,r4,2240)
    ...
    0000EE  E300  4888  0024 000019 | STG r0,#MX_TEMP1(,r4,2184)
    
    
    When optimization is used, the parameter list temp value for the
    1-byte enum is incorrect.  THe LLC/STC instructions are used to
    load and save only the 1-byte instead of a full 32-bit word.
    The 1-byte enum ends up being stored in the first 8-bits of the
    temp area:
    
    0000A4  E300  1008  0094 000019 | LLC
                                r0,(*)mystruct.mystruct.val(,r1,8)
    ...
    0000B6  4200  4958       000019 | STC r0,<a1:d2392:l1>(,r4,2392)
    0000BA  4100  4958       000019 | LA r0,#wtemp_1(,r4,2392)
    ...
    0000DE  E300  4888  0024 000019 | STG r0,#MX_TEMP1(,r4,2184)
    
    
    
       === TEST CASE ===
    
    > xlc_64 -O2 apar.c
    
    typedef enum myenum
    {
       ZERO  = 0,
       ONE   = 1
    } ONEBYTEENUM;
    
    #pragma linkage(my_extern_func,OS64_NOSTACK)
    int  my_extern_func(const char *a, ONEBYTEENUM  b);
    
    typedef struct mystruct
    {
       char         *name;
       ONEBYTEENUM  val;
    } my_values;
    
    
    void test( my_values *c)
    {
    my_extern_func( c->name, c->val );
    }
    

Local fix

  • Do not use optimization.
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED: Users of compiler options: XPLINK, LP32 with *
    *                 HGPR, or LP64, plus OPT, and ARCH(7) &&nbsp; *
    *                 above; and calling a function with linkage   *
    *                 OS, and char or short parameter              *
    ****************************************************************
    * PROBLEM DESCRIPTION: The affected users will get an          *
    *                      incorrect value from loading the        *
    *                      argument address from the argument      *
    *                      list                                    *
    ****************************************************************
    .
    

Problem conclusion

  • Apply service provided.
    

Temporary fix

Comments

APAR Information

  • APAR number

    PI96691

  • 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-04-13

  • Closed date

    2018-05-03

  • Last modified date

    2018-06-04

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

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

    PI99715

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 UI55634

       UP18/05/30 P F805

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