IBM Support

IV12522: 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

    IV12522

  • Reported component name

    XL C++ AIX

  • Reported component ID

    5724U8100

  • Reported release

    A10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2011-12-21

  • Closed date

    2012-01-26

  • Last modified date

    2012-01-26

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

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

    IV14244 IV18591 LI76810 LI76891 LI76906

Fix information

  • Fixed component name

    XL C++ AIX

  • Fixed component ID

    5724U8100

Applicable component levels

  • RA10 PSY U850221

       UP C



Document information

More support for: XL C/C++

Software version: A.1

Reference #: IV12522

Modified date: 26 January 2012


Translate this page: