Red Hat Bugzilla – Bug 1000991
fmaf() function get a wrong rounded result
Last modified: 2016-11-24 10:56:16 EST
Created attachment 790358 [details]
test example and Makefile
Description of problem:
fmaf() function get a wrong rounded result when arguments are passed through variables
There are three variants.
First. Arguments are passed to fmaf() by pointers referenced to floating point single precision numbers placed in int32 type variables (0x007ffffa, 0x4ea00000, 0x00000001)
The result is wrong and equal 0x0f9ffff8.
Arguments are passed to fmaf() by pointers referenced to floating point single precision numbers placed in float type variables (a=0x0.fffff4p-126, b=0x1.400000p30, c=0x0.000002p-126). The result is also wrong and equal 0x0f9ffff8.
Floating point numbers are passed as immediate values(0x0.fffff4p-126, 0x1.400000p30, 0x0.000002p-126). Result is correct and equal 0x0f9ffff9.
The difference between wrong and correct results is one ulp.
Version-Release number of selected component (if applicable):
glibc version 2.12, gnu_get_libc_version()
Red Hat Enterprise Linux 6.4
make -f Makefile_bug
Steps to Reproduce:
Carlos, are you going to look at the bug?
Thanks for submitting this bug.
Your example is unfortunately illegal since it violates ISO C strict aliasing. For example you assign a pointer to int/unsigned int and float to the same address, all of this needs to be done through unions to be safe. Please make sure that `-Wall -pedantic' don't produce any errors when you compile.
To learn more about strict aliasing please read:
One of our developers looked into this and I'll let her update the issue.
We are not going to include this in rhel-6.5, but we may consider it for rhel-6.6.
I was able to confirm that your test program produces the correct results on a RHEL 6.5 system with FMA support.
I will be closing this bug report.
Please reopen this bug report if you continue to see incorrect results on RHEL 6.5.