IBM Support

IZ83163: INCORRECT RESULT FROM FP_INVALID_OP()

Fixes are available

September 2010 PTF for XL C for AIX, V11.1
September 2010 PTF for XL C/C++ for AIX, V11.1
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

  • After enabling floating point exceptions at runtime and
    compiling with -O3 and -qstrict, the following test case is
    giving incorrect output for fp_invalid_op().
    
    
         ====  TEST CASE  ====
    
    #include <stdio.h>
    #include <math.h>
    #include <fptrap.h>
    
    double x = -1;
    
    int main()
    {
      int i, j;
      double sum;
    
      (void) fp_enable(TRP_INVALID);
    
      sum = 0;
      if (x > 0)
        sum += log(x);
      printf("sum %g\n", sum);
    
      x += sum;
    
      for (i = 0; i < 1; i++)
        for (j = 0; j < 1; j++)
          ;
    
      printf("fp_invalid_op() => %d\n", fp_invalid_op());
      return 0;
    }
    
    
    $ xlc -O3 -qstrict test.c -lm
    sum 0
    fp_invalid_op() => 1
    $ xlc test.c -lm
    sum 0
    fp_invalid_op() => 0
    $
    

Local fix

  • Compile with either lower optimization, -qnohot, or -qflttrap.
    

Problem summary

  • PROBLEM DESCRIPTION:
    Floating point instruction speculation triggers floating point
    traps when traps are enabled at runtime via fp_enable().  These
    traps are detected by the fp_invalid_op() function.
    
    USERS AFFECTED:
    Users who utilize fp_enable to enable floating point traps at
    runtime.
    

Problem conclusion

  • Floating point speculation that may cause traps can now be
    disabled by compiling with the options:  -qfloat=fenv
    -qstrict=guards
    

Temporary fix

Comments

APAR Information

  • APAR number

    IZ83163

  • Reported component name

    XL C/C++ AIX

  • Reported component ID

    5724X1300

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2010-08-19

  • Closed date

    2010-09-10

  • Last modified date

    2010-09-10

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

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

    LI75801

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:
07 October 2021