IBM Support

LI80862: REORDERED ASSEMBLER INSTRUCTIONS BREAKING IF STATEMENT ARGUMENT EVALUATION ORDER

Subscribe to this APAR

By subscribing, you receive periodic emails alerting you to the status of the APAR, along with a link to the fix after it becomes available. You can track this item individually or track all items by product.

Notify me when this APAR changes.

Notify me when an APAR for this component changes.

APAR status

  • Closed as program error.

Error description

  • When optimization is enabled, some generated floating point
    assembler instructions are scheduled in such a way as to mix up
    the order in which statements are evaluated in a compound IF
    statement.
    
    Depending on the external effect these IF conditional statements
    have (and the order in which they are called), the application
    behaviour may be incorrect.
    
    
       === EXAMPLE ===
    
    +16  if (!test(a) &&
    +17      !test(b) &&
    +18          a<b)
    +19    return TRUE;
    +20  else
    +21    return FALSE;
    
    The generated code looks like:
    
       16| 000204 xststdcdp  F0400DA8   1     TSTDCDP    cr0=vs1,64
       22| 000208 bc         40850008   0     TCFEX_B    cr1
       22| 00020C tw         7C8F7808   2
       18| 000210 xscmpodp   F3011158   1     CFLO       cr6=vs1,vs2
      ^^^^==> Line +18 is evaluated BEFORE line +17.  The code
              expects and requires test(b) to be run first.
    
       21| 000214 addi       38600000   1     LI         gr3=0
       17| 000218 xststdcdp  F0C015A8   1     TSTDCDP    cr1=vs2,64
       16| 00021C bc         41820010   0     BT  CL.10,cr0,0x4/eq
       17| 000220 bc         4186000C   1     BT  CL.10,cr1,0x4/eq
       18| 000224 bc         40980008   2     BF  CL.10,cr6,0x20/flt
    

Local fix

  • Use a lower optimization level.
    

Problem summary

  • PROBLEM DESCRIPTION:
    Speculative scheduling of conditionals with ordered compare can
    cause unexpected program behaviour.
    
    USERS AFFECTED:
    Users with ordered compares.
    

Problem conclusion

  • Ordered compares are flagged for code reorganization
    optimization.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI80862

  • Reported component name

    XL C/C++ LINUX

  • Reported component ID

    5725C7310

  • Reported release

    G11

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2019-05-31

  • Closed date

    2019-06-21

  • Last modified date

    2019-06-21

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

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

Fix information

  • Fixed component name

    XL C/C++ LINUX

  • Fixed component ID

    5725C7310

Applicable component levels



Document information

More support for: XL C/C++ for Linux

Software version: G11

Reference #: LI80862

Modified date: 21 June 2019