IBM Support

IZ84572: FP_INVALID_OP() INCORRECT OUTPUT WITH -O3

Fixes are available

January 2011 PTF for XL C/C++ for AIX, V11.1
May 2011 PTF for XL C for AIX, V11.1
May 2011 PTF for XL C/C++ for AIX, V11.1
August 2011 PTF for XL C/C++ for AIX, V11.1
November 2011 PTF for XL C/C++ for AIX, V11.1
January 2012 PTF for XL C for AIX, V11.1
January 2012 PTF for XL C/C++ for AIX, V11.1
April 2012 PTF for XL C for AIX, V11.1
April 2012 PTF for XL C/C++ for AIX, V11.1
July 2012 PTF for XL C/C++ for AIX, V11.1
October 2012 PTF for XL C for AIX, V11.1
October 2012 PTF for XL C/C++ for AIX, V11.1
February 2013 PTF for XL C for AIX, V11.1
February 2013 PTF for XL C/C++ for AIX, V11.1
XL C/C++ for AIX Fix Pack 14 (May 2013 PTF) for 11.1
XL C for AIX Fix Pack 14 (May 2013 PTF) for 11.1
XL C/C++ for AIX Fix Pack 15 (August 2013 PTF) for 11.1
XL C for AIX Fix Pack 15 (August 2013 PTF) for 11.1
XL C/C++ for AIX Fix Pack 16 (November 2013 PTF) for 11.1
XL C for AIX Fix Pack 17 (February 2014 PTF) for 11.1
XL C/C++ for AIX Fix Pack 17 (February 2014 PTF) for 11.1
XL C/C++ for AIX Fix Pack 18 (May 2014 PTF) for 11.1
XL C/C++ for AIX Fix Pack 19 (August 2014 PTF) for 11.1
XL C/C++ for AIX Fix Pack 20 (November 2014 PTF) for 11.1
XL C for AIX Fix Pack 21 (April 2015 PTF) for 11.1
XL C/C++ for AIX Fix Pack 21 (April 2015 PTF) for 11.1
XL C/C++ for AIX Fix Pack 22 (September 2015 PTF) for 11.1
XL C for AIX Fix Pack 23 (March 2016 PTF) for 11.1
XL C/C++ for AIX Fix Pack 23 (March 2016 PTF) for 11.1
XL C for AIX Fix Pack 24 (September 2016 PTF) for 11.1
XL C/C++ for AIX Fix Pack 24 (September 2016 PTF) for 11.1
January 2011 PTF for XL C for AIX, V11.1
August 2011 PTF for XL C for AIX, V11.1
November 2011 PTF for XL C for AIX, V11.1
July 2012 PTF for XL C for AIX, V11.1
XL C for AIX Fix Pack 16 (November 2013 PTF) for 11.1
XL C for AIX Fix Pack 18 (May 2014 PTF) for 11.1
XL C for AIX Fix Pack 19 (August 2014 PTF) for 11.1
XL C for AIX Fix Pack 20 (November 2014 PTF) for 11.1
XL C for AIX Fix Pack 22 (September 2015 PTF) for 11.1

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The following test case produces incorrect result for
    fp_invalid_op() if compiled with -O3 with V11.1 XL C/C++.
    
    
    ==== TESTCASE:
    cat fltint3.c
    #include <stdio.h>
    #include <fptrap.h>
    
    void foo(int val, int *dst)
    {
      int i;
    
      for (i = 0; i < 1; i++)
        *dst = val;
    }
    
    int zero;
    
    void bar(char *fmt)
    {
      int rc, i, c, t;
      double x;
    
      rc = 0 ;
      x = zero ? 0 : 1e100;
    
      for (i = 0; i < 1 && rc == 0; i++)
      {
        c = fmt[0];
        printf("i %d  c '%c'\n", i, c);
        switch (c)
        {
        case 'A':                  break;
        case 'B': foo((int)x, &t); break;
        default:           rc = 1; break;
        }
      }
    }
    
    int main()
    {
      (void) fp_enable(TRP_INVALID);
      bar("0");
      printf("fp_invalid_op() => %d\n", fp_invalid_op());
      return 0;
    }
    
    
    
    
    ===== ACTUAL OUTPUT:
    
    $xlc -O3 -qstrict fltint3.c && ./a.out
     i 0  c '0'
     fp_invalid_op() => 1
    
    
    ===== EXPECTED OUTPUT:
     i 0  c '0'
     fp_invalid_op() => 0
    

Local fix

  • Use -O2 or -qnohot
    

Problem summary

  • PROBLEM DESCRIPTION: Unexpected floating point trap
    
    USERS AFFECTED: Users who use IPA and enable floating point
    traps
    

Problem conclusion

  • After this fix, affected users will need to use -qfloat=fenv or
    -qstrict=guards.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IZ84572

  • Reported component name

    XL C FOR AIX

  • Reported component ID

    5724X1200

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2010-09-08

  • Closed date

    2011-01-03

  • Last modified date

    2011-01-05

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

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

    LI75793

Fix information

  • Fixed component name

    XL C FOR AIX

  • Fixed component ID

    5724X1200

Applicable component levels

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

Document Information

Modified date:
06 October 2021