IBM Support

LI77647: DIS OUTPUT DOES NOT SHOW CMPB MNEMONIC

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • When using the dis-assembler, the cmpb instruction is not shown
    in the .s output file for the corresponding source code:
    
    ======Testcase:
    $ cat test.C
    #include <string.h>
    #include <builtins.h>
    #include <stdio.h>
    
    #define Uint64 unsigned long long
    #define Uint32 unsigned int
    #define Uint unsigned long long
    #define UintPtr intptr_t
    
    extern "C" size_t strlen_org(const char *s) { return strlen(s);
    }
    
    extern "C" size_t strlen_pwr6(const char *s)
    {
       UintPtr offset = ((UintPtr)s) & 7;
       Uint64 *alignedPtr = (Uint64 *)(s-offset);
       Uint64 a = *alignedPtr;
       Uint64 mask = -1;
       mask <<= offset*8;
       a |=  ~mask;
       Uint64 cmpb = __cmpb(a,0);
       while (cmpb == 0)
       {
          alignedPtr++;
          a = *alignedPtr;
          cmpb = __cmpb(a,0);
    
          if (cmpb != 0) break;
    
          alignedPtr++;
          a = *alignedPtr;
          cmpb = __cmpb(a,0);
       }
       size_t res = (size_t)((const char *)alignedPtr - s);
       res += __cntlz8(cmpb)/8;
       return res;
    }
    
    int main(int argc, char *argv[])
    {
      size_t s;
      char dest[1024*1024];
      memset(dest, 'x', sizeof(dest));
      dest[sizeof(dest)-1] = '\0';
    
      switch(argv[1][0])
      {
      case 'a' : for (int i=0; i < 10000; i++) s = strlen_org(dest);
    break;
      case 'c' : for (int i=0; i < 10000; i++) s =
    strlen_pwr6(dest); break;
      }
      printf("%ull\n", s);
      return s;
    }
    $
    
    ===== COMPILE COMMAND:
    xlC -q64 -O2 strlen.C -qlist -qarch=pwr7
    /usr/vac/exe/dis a.out
    
    ===== ACTUAL OUTPUT:
    When analyzing the .s file, the cmpb instruction is missing:
    
    .strlen_pwr6:                           # 0x00000001000007a0
    (H.155.
    NO_SYMBOL+0x040)
            rlwinm     r4,r3,0,29,31
            addi       r0,r0,-1
            addi       r5,r0,0
            subf       r4,r4,r3
            rlwinm     r6,r3,3,26,28
            ld         r7,0(r4)
            sld        r0,r0,r6
            orc        r0,r7,r0
            .long   0x7ca003f8              # "|\240\003\370"
            .long   0x2c200000              # ", \0\0"
            .long   0x40820048              # "@\202\0H"
            .long   0x60000000              # "`\0\0\0"
    
    
    ===== EXPECTED OUTPUT:
    The cmpb instruction needs to be there.
    

Local fix

  • Use the -qlist option instead of -s
    

Problem summary

  • USERS AFFECTED:
    Users who want to read assembly files that include any one of
    the cmpb, frsqrtes, frsqrtes and wait mnemonics are affected by
    this issue.
    
    PROBLEM DESCRIPTION:
    The disassembler (ie dis) cannot figure out cmpb, frsqrtes,
    frsqrtes and wait mnemonic instructions.
    

Problem conclusion

  • The disassembler has been taught to handle the above mnemonics.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI77647

  • Reported component name

    XL C/C++ FOR LI

  • Reported component ID

    5725C7300

  • Reported release

    C10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2013-10-28

  • Closed date

    2013-10-28

  • Last modified date

    2013-10-28

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

    IV49970

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

Fix information

  • Fixed component name

    XL C/C++ FOR LI

  • Fixed component ID

    5725C7300

Applicable component levels

  • RC10 PSY

       UP



Document information

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

Software version: 12.1

Reference #: LI77647

Modified date: 28 October 2013