IBM Support

PH68887: METAL C CLOBBERS HIGH ORDER BITS

A fix is available

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When using a unsigned short for a typedef, Metal C compiler
    generates a LLGH that will overwrite the bits of the high halves
    with zeros.
    
    Based on the description of LLGH from the Principles of
    Operation:
    """
    For LOAD LOGICAL HALFWORD (LLGH, LLGHR) and LOAD LOGICAL
    HALFWORD RELATIVE LONG (LLGHRL), zeros are placed in bit
    positions 0-47 of general register R1
    """ For example with this testcase:
    ===== TESTCASE:
    
    #pragma csect(code,"CSQXOJWT")
    #pragma csect(static,"CSTXOJWT")
    
    #include <metal.h>
    
    typedef unsigned short myint;
    // typedef long long int myint;
    // typedef int myint;
    
    int func3(char * pcs);
    
    const char * func2(myint s1, myint s2)
    {  char * pcs = "some string";
     return pcs;
    }
    
    int func1(myint s1, myint s2)
    {  int i;
     char cs[32];
     i = strlen(func2(s1, s2));
     memcpy(cs, func2(s1, s2), i);
     return func3(cs);
    }
    
    ===== COMPILE COMMAND:
    
    xlC -S -qmetal -O2 -qlist -qsource -qnoinline -qnosearch
    -I/usr/include/metal test.c > test.lst
    
    ===== ACTUAL OUTPUT:
    
    * {
    
    
    *   int i;
    
    
    *   char cs[32];
    
    
    *   i = strlen(func2(s1, s2));
    
    
            USING @@PARMD@1,1
    
    
            LLGH  2,@8s1@2+2             ----> LLGH generated
    
    
            LLGH  4,@9s2@3+2
    
    
            LA    1,76(,13)               #MX_TEMP1
    
    
            ST    2,76(,13)               #MX_TEMP1
    
    
            ST    4,80(,13)               #MX_TEMP1
    
    
            MVC   8(4,13),#NAB_1
    
    
            BRASL 14,FUNC2
    
    
    
    Compiler needs to be corrected to generate a instruction that
    does not remove the high order bits.
    

Local fix

  • NA
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED: Users of IBM z/OS XL C/C++ V2.4              *
    *                 with the METAL, HGPR(PRESERVE), and ILP32    *
    *                 options                                      *
    *                 and source code that uses 2 byte data        *
    *                 types (e.g. short),                          *
    ****************************************************************
    * PROBLEM DESCRIPTION: The compiler may generate code          *
    *                      that does clobbers the high half of     *
    *                      some general                            *
    *                      registers.                              *
    ****************************************************************
    * RECOMMENDATION: Install the PTF                              *
    ****************************************************************
    N/A
    

Problem conclusion

  • Install the PTF
    

Temporary fix

Comments

APAR Information

  • APAR number

    PH68887

  • Reported component name

    C/C++ FOR MVS

  • Reported component ID

    56551210A

  • Reported release

    7C0

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2025-11-10

  • Closed date

    2026-03-27

  • Last modified date

    2026-05-02

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

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

Modules/Macros

  • CCNECICS CCNECWI  CCNED240 CCNEDSCT CCNEDWRT CCNEFILT CCNEHIFC
    CCNEIPA3 CCNEIPAO CCNEMDEP CCNEOPTP CCNEP    CCNEPP   CCNETBY
    CCNMSGE  CCNMSGT  CCNQIPA
    

Fix information

  • Fixed component name

    C/C++ FOR MVS

  • Fixed component ID

    56551210A

Applicable component levels

  • R7C0 PSY UO07332

       UP26/04/23 P F604

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":"7C0","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
02 May 2026