IBM Support

LI75146: COMPILER ABEND WHEN MEMCMP HAS A NEGATIVE LENGTH

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • xlCcode will abend with a memcmp that has a negative length
    under some cases.  This is a simplified test case is as follows:
    ---
    #include <string.h>
    
    char *a1, *a2;
    
    int bar1(void);
    int bar2(void);
    
    int main(void) {
      if (memcmp(a1, a2, -2)) {
        bar1();
      } else {
        bar2();
      }
      return 0;
    }
    ---
    
    Compile Line:
    xlC -c -O2 test.cpp
    (Also occurs in 64 bit mode)
    

Local fix

  • n/a
    

Problem summary

  • Users of memcmp() with negative size value (or
    equivalently, large unsigned value) that are
    compiling at -O2 or higher are affected by this issue.
    
    There is a defect in the compiler inline code of
    the memcmp() builtin for large unsigned value.
    

Problem conclusion

  • The code that expands the memcmp() builtin
    does not handle well negative length values (large
    unsigned values).  We fixed it by adding additional range
    check code so that we don't do inline expansion for
    this case.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI75146

  • Reported component name

    XL C/C++ SLES10

  • Reported component ID

    5724U8300

  • Reported release

    A10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2009-12-01

  • Closed date

    2009-12-01

  • Last modified date

    2009-12-01

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

    IZ47922

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

Fix information

  • Fixed component name

    XL C/C++ SLES10

  • Fixed component ID

    5724U8300

Applicable component levels

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SSJT9L","label":"XL C\/C++"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"A.1","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
14 October 2021