IBM Support

IV18591: ASM ERROR WITH [NAME] AND + OPERAND

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The compiler fails to compile correctly when there is a use
    of [name] and when the operand has a "+" and uses a memory
    constraint.
    
    The following test case demonstrates the issue:
    
    ===== COMPILE COMMAND:
    xlC_r test_m.cpp
    
    ===== TESTCASE:
    $cat test_m.cpp
      inline static void store_timestamp(unsigned long *buffer) {
          asm(
            "    ldx     5,%[buffer] \n\t"  /* get old value  */
            "    mfctr   6           \n\t"  /* get new timer value
    */
            "    subf    6,5,6       \n\t"  /* calc new - old */
            "    stdx    6,%[buffer] \n\t"  /* and save       */
            : [buffer] "+m" (*buffer)       /* outputs   */
            :                               /* inputs    */
            : "r5", "r6"                    /* clobbered */
          );
          return;
      }
    
      inline static void inc_atomic(unsigned long volatile *ctr) {
        asm(
          "    lwsync              \n\t"
          "1:  ldarx   5,%[ctr]    \n\t"    // get old ctr and
    reserve
          "    addi    6,5,1       \n\t"    // increment
          "    stdcx.  6,%[ctr]    \n\t"    // store updated value
          "    bne     1b          \n\t"    // reservation lost? ->
    retry
          "    isync               \n\t"
          : [ctr] "+m" (*ctr)               /* outputs   */
          :                                 /* inputs    */
          : "cr0", "r5", "r6"               /* clobbered */
        );
        return;
      }
    
      inline static void add_atomic(unsigned long volatile *sum,
    unsigned long inc) {
        asm(
          "    lwsync              \n\t"
          "1:  ldarx   5,%[sum]    \n\t"    // get old ctr and
    reserve
          "    add     6,5,[inc]   \n\t"    // increment
          "    stdcx.  6,%[sum]    \n\t"    // store updated value
          "    bne     1b          \n\t"    // reservation lost? ->
    retry
          "    isync               \n\t"
          : [sum] "+m" (*sum)               /* outputs   */
          : [inc] "b"  (inc)                /* inputs    */
          : "cr0", "r5", "r6"               /* clobbered */
        );
        return;
      }
    
    int main()
    {
            unsigned long * temp1 = 0;
            unsigned long volatile * temp2 = 0;
            unsigned long temp3 = 0;
    
            store_timestamp(temp1);
            inc_atomic(temp2);
            add_atomic(temp2, temp3);
    
            return 0;
    }
    $
    
    ===== ACTUAL OUTPUT:
    $ xlC_r test_m.cpp
    "test_m.cpp", line 7.11: 1540-0548 (S) The symbolic name buffer
    used in a %[name] operand specifier is duplicated.
    $
    
    
    ===== EXPECTED OUTPUT:
    Should compile clean.
    

Local fix

  • n/a
    

Problem summary

  • USERS AFFECTED:
    Users who make use of duplicate symbols to represent output
    operand with matching constraint may be affected by this issue.
    
    PROBLEM DESCRIPTION:
    When output operands with +m constraints, the compiler converts
    output operands into input operands.
    The compiler then issues a diagnostic message on the duplicate
    symbols used for these kind of input operands.
    

Problem conclusion

  • Disable the compiler from issuing the error message when input
    operands has matching constraints.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IV18591

  • Reported component name

    XL C/C++ AIX

  • Reported component ID

    5724X1300

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2012-03-29

  • Closed date

    2012-03-29

  • Last modified date

    2012-03-29

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

    IV12522

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

Fix information

  • Fixed component name

    XL C/C++ AIX

  • Fixed component ID

    5724X1300

Applicable component levels

  • RB10 PSN U851438

       UP06/09/13 C

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSGH3R","label":"XL C\/C++ for AIX"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"11.1","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
29 March 2012