IBM Support

PH61160: METAL C NESTED 'IF' STATEMENTS FOR PTR64 CAUSE BAD CODE GEN

A fix is available

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When compiling a Metal C file with nested if statements:
    
    >cat a.c
    int free64(void * __ptr64 a) __attribute__((amode64));
    int test (void * __ptr64 p) {
     if ( p ) {
       if ( p ) {
         free64(p);
       }
     }
     return 0;
    }
    >xlc a.c -qmetal -S -O3 -o fail.s
    >
    
    The assembly code generated for this __ptr64 example above is
    not correct. The assembly code contains LCR and O 32-bit
    statements:
       40  *   if ( p ) {
                   000003
       41           USING @@PARMD@1,1
                   000003
       42           LG    14,@2p
                   000003
       43           LCR   15,14
                   000003
       44           O     15,@2p+4
                   000003
       45  *     if ( p ) {
                   000004
    
    The assembly code for __ptr64 needs to generate LCGR and OG
    64-bit statements.
    

Local fix

  • Compile at NOOPT or disable HGPR.
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED: Users of V2R4 XL C/C++ at OPT(2)             *
    *                 or above, with ILP32, HGPR, and XPLINK or    *
    *                 METAL                                        *
    ****************************************************************
    * PROBLEM DESCRIPTION: The compiler may generate               *
    *                      code which is incorrect for a           *
    *                      comparison of an 8                      *
    *                      byte data to 0.                         *
    ****************************************************************
    * RECOMMENDATION: Install the PTF                              *
    ****************************************************************
    N/A
    

Problem conclusion

  • Install the PTF or use workaround
    

Temporary fix

Comments

APAR Information

  • APAR number

    PH61160

  • 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

    2024-04-30

  • Closed date

    2024-10-09

  • Last modified date

    2024-11-03

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

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

    UI98701

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 UI98701

       UP24/10/30 P F410

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:
03 November 2024