IBM Support

IZ47922: COMPILER ABEND WHEN MEMCMP HAS A NEGATIVE LENGTH

Fixes are available

May 2009 PTF for XL C for AIX, V10.1
November 2009 PTF for XL C/C++ for AIX, V10.1
October 2010 PTF for XL C/C++ for AIX, V10.1
October 2010 PTF for XL C for AIX, V10.1
May 2012 PTF for XL C/C++ for AIX, V10.1
January 2013 PTF for XL C for AIX, V10.1
January 2013 PTF for XL C/C++ for AIX, V10.1
XL C/C++ for AIX Fix Pack 18 (July 2013 PTF) for 10.1
XL C/C++ for AIX Fix Pack 19 (October 2013 PTF) for 10.1
XL C/C++ for AIX Fix Pack 21 (October 2015 PTF) for 10.1
XL C for AIX Fix Pack 21 (October 2015 PTF) for 10.1
August 2009 PTF for XL C for AIX, V10.1
August 2009 PTF for XL C/C++ for AIX, V10.1
November 2009 PTF for XL C for AIX, V10.1
March 2010 PTF for XL C for AIX, V10.1
March 2010 PTF for XL C/C++ for AIX, V10.1
April 2010 PTF for XL C for AIX, V10.1
April 2010 PTF for XL C/C++ for AIX, V10.1
June 2010 PTF for XL C/C++ for AIX, V10.1
June 2010 PTF for XL C for AIX, V10.1
February 2011 PTF for XL C for AIX, V10.1
May 2011 PTF for XL C/C++ for AIX, V10.1
May 2011 PTF for XL C for AIX, V10.1
October 2011 PTF for XL C/C++ for AIX, V10.1
October 2011 PTF for XL C for AIX, V10.1
February 2012 PTF for XL C for AIX, V10.1
February 2012 PTF for XL C/C++ for AIX, V10.1
May 2012 PTF for XL C for AIX, V10.1
September 2012 PTF for XL C for AIX, V10.1
September 2012 PTF for XL C/C++ for AIX, V10.1
XL C for AIX Fix Pack 18 (July 2013 PTF) for 10.1
XL C for AIX Fix Pack 19 (October 2013 PTF) for 10.1
May 2009 PTF for XL C/C++ for AIX, V10.1
XL C for AIX Fix Pack 20 (October 2014 PTF) for 10.1
XL C/C++ for AIX Fix Pack 20 (October 2014 PTF) for 10.1

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

    IZ47922

  • 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

    2009-03-30

  • Closed date

    2009-05-21

  • Last modified date

    2009-06-03

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

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

    LI75105 LI75146

Fix information

  • Fixed component name

    XL C AIX

  • Fixed component ID

    5724U8000

Applicable component levels

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

Document Information

Modified date:
04 October 2021