IBM Support

LI76118: INCORRECT BRANCH WITH BUILTINS

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • This is a test for the builtin long __fetch_and_swaplp(volatile
    long*, long);
    
    inline intptr_t Atomic::xchg_ptr(intptr_t exchange_value,
    volatile intptr_t* dest) {
      long old_value;
      __lwsync();
      old_value = __fetch_and_swaplp(dest, exchange_value);
      __isync();
      return (intptr_t) old_value;
    }
    
    And this is the disassembled code:
    
    $ dbx cpp_test
    Type 'help' for help.
    reading symbolic information ...
    (dbx) listi test_xchg_ptr
    0x100000c00 (test_xchg_ptr(long,volatile long*))      7c2004ac
    sync
    0x100000c04 (test_xchg_ptr(long,volatile long*)+0x4)  7c0020a8
    ldarx   r0,r0,r4
    0x100000c08 (test_xchg_ptr(long,volatile long*)+0x8)  7c6021ad
    stdcx.   r3,r0,r4
    0x100000c0c (test_xchg_ptr(long,volatile long*)+0xc)  40a2fff8
    bne   0x100000c14 (test_xchg_ptr(long,volatile long*)+0x4)
    0x100000c10 (test_xchg_ptr(long,volatile long*)+0x10) 4c00012c
    isync
    0x100000c14 (test_xchg_ptr(long,volatile long*)+0x14) 60030000
    ori   r3,r0,0x0
    0x100000c18 (test_xchg_ptr(long,volatile long*)+0x18) 4e800020
    blr
    
    The problem is the bne at 0x100000c0c. It should branch back to
    the ldarx at 0x100000c04, if the stdcx fails,
    but instead it branches forward to 0x100000c14 and then
    xchg_ptr() returns without having stored exchange_value to dest.
    
    The problem seems to occur when mixing inline assembler with
    built-ins.
    

Local fix

  • N/A
    

Problem summary

  • USERS AFFECTED:
    Users who inter-mix asm statements and compiler built-ins may
    be affected by this issue.
    
    PROBLEM DESCRIPTION:
    The resulting assembler file contained incorrect assembly code
    for branches, which resulted in incorrect execution
    of the code at runtime.
    

Problem conclusion

  • The compiler has been fixed so that it will generate correct
    assembly code for branches.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI76118

  • Reported component name

    XL C/C++ FOR LI

  • Reported component ID

    5724X1400

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2011-04-27

  • Closed date

    2011-04-27

  • Last modified date

    2011-04-27

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

    IZ94262

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

Fix information

  • Fixed component name

    XL C/C++ FOR LI

  • Fixed component ID

    5724X1400

Applicable component levels

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSXVZZ","label":"XL C\/C++ for Linux"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"B10","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
17 October 2021