Bug 1121

Summary: LSB 4.1: error from "abs" of math function
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Xiaofeng Yan <Xiaofeng.yan>
Component: coreAssignee: Kai Kang <kai.kang>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: brett.ciphery, jessica.zhang, kai.kang, liezhi.yang, mark.hatle, meta.mr.watcher, meta.watcher, sgw, yi.zhao
Version: 1.0-alpha   
Target Milestone: 1.4 M4   
Hardware: mpc8315e-rdb   
OS: ppc   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---
Attachments:
Description Flags
test program about data type long double none

Description Xiaofeng Yan 2011-05-27 05:09:10 UTC
/26_numerics/complex/13450.cc 1 	failed 	
Message from the test:

DejaGNUTest.command_1: 
DejaGNUTest.command_1: /opt/lsb/test/lib/libstdcpp_4.1.0/_26_numerics_complex_13450.exe
DejaGNUTest.command_1: 
DejaGNUTest.command_1: 
DejaGNUTest.command_output_1: 
DejaGNUTest.command_output_1: _26_numerics_complex_13450.exe: /nethome/autobuild/tmp/rpm-build/BUILD/lsb-test-libstdcpp-4.1.0/testsuite/26_numerics/complex/13450.cc:41: void test01_do(T, T) [with T = long double]: Assertion `abs(ref - res2) < eps' failed.
DejaGNUTest.command_output_1: 
DejaGNUTest.command_output_1: 
DejaGNUTest.command_status_1: 6
DejaGNUTest.result_1: FAIL: 26_numerics/complex/13450.cc execution test
INFO: qmtest.cause: 26_numerics/complex/13450.cc execution test
INFO: qmtest.end_time: 2011-05-23T01:06:49Z
INFO: qmtest.start_time: 2011-05-23T01:06:49Z
INFO: qmtest.target: local
Comment 1 Xiaofeng Yan 2011-05-27 05:09:42 UTC
I record this bug and will fix it on 1.1
Comment 2 Xiaofeng Yan 2011-05-31 23:38:02 UTC
Created attachment 169 [details]
test program about data type long double
Comment 3 Xiaofeng Yan 2011-05-31 23:50:28 UTC
Hi Mark,

This bug is caused by data type "long double".
Please check attachment to get test program. 
Look at my test steps
$./powerpc-poky-linux-g++ abs.cc -o abs -g
mpc8315e#./abs
c

When I run this program on x86 (OS ubuntu), I got information "a" instead of "c". The correct result should be "a".
if the type of variable "ld1" and "ld2" is "long" or "double", output information is "a" on mpc8315e.
I think it is float-precision problem. I don't know this bug comes from  hardware or complication tool or glibc? Can you give me suggestion about my question?

I have checked that mpc8315e supports hard-float.
TARGET_CC_ARCH = "-mcpu=603e  -mhard-float" 

The following information come from gdb
test01_do<long double> (a=-3.2000000000000002, b=1.3999999999999999)
    at abs.cc:11
11          bool test __attribute__((unused)) = true;
(gdb) n
14          T eps = numeric_limits<T>::epsilon() * 100;
(gdb) n
16          cplx ref = pow(cplx(a, T()), cplx(b, T()));
(gdb) n
17          cplx res1 = pow(a, cplx(b, T()));
(gdb) n
18          cplx res2 = pow(cplx(a, T()), b);
(gdb) n
20           assert (abs(ref - res1) < eps);
(gdb) p ref
$1 = {_M_value = -1.5746800804295207 + -4.8463669598557395 * I}
(gdb) p res1
$2 = {_M_value = -1.5746800804295207 + -4.8463669598557395 * I}
(gdb) p res2
$3 = {_M_value = -1.5746800804295207 + -4.8463669598557395 * I}
(gdb) p eps
$4 = 4.9406564584124654e-322
(gdb) n
21           assert( abs(ref - res2) < eps );
(gdb) p eps
$5 = 4.9406564584124654e-322
(gdb) p ref
$6 = {_M_value = -1.5746800804295207 + -4.8463669598557395 * I}
(gdb) p eps
$7 = 4.9406564584124654e-322
(gdb) p ref
$8 = {_M_value = -1.5746800804295207 + -4.8463669598557395 * I}
(gdb) p res1
$9 = {_M_value = -1.5746800804295207 + -4.8463669598557395 * I}
(gdb) p res2
$10 = {_M_value = -1.5746800804295207 + -4.8463669598557395 * I}
(gdb) p ref
$11 = {_M_value = -1.5746800804295207 + -4.8463669598557395 * I}
(gdb) n    
abs: abs.cc:21: void test01_do(T, T) [with T = long double]: Assertion `abs(ref - res2) < eps' failed.

Program received signal SIGABRT, Aborted.
0x0fe55e9c in raise () from /lib/libc.so.6
Comment 4 Xiaofeng Yan 2011-06-01 05:30:09 UTC
Hi Mark,

I also check the user manual of e300 core. It says single-precision(32bits) and double-precision(64 bits) can be supported but I don't know whether quad-precision(128 bits) is supported or not? I can't find this words. I also run this test binary on wind river ppc(e440) platform and get same result. I guess it could be real hardware problem. At present wind river makes lsb test by LSB 4.0. We use LSB 4.1 to make lsb test for yocto.
Comment 5 Brett Ciphery 2011-06-01 11:01:15 UTC
This looks like an acknowledged upstream bug:

http://bugs.linuxbase.org/show_bug.cgi?id=2447

So it's not necessary to fix anything, the problem will be waived.
Comment 6 Xiaofeng Yan 2011-06-29 04:40:22 UTC
upstream http://bugs.linuxbase.org/show_bug.cgi?id=2447
Comment 7 Kai Kang 2012-10-18 07:37:44 UTC
Libstdc++ test aborted on ppc, so can't verify this on ppc. Pass on x86 and x86_64
Comment 8 Kai Kang 2013-02-22 07:36:57 UTC
Test passed with "lsb-test-libstdcpp v. 4.1.0-18.lsb4 "
Comment 9 Yi Zhao 2013-04-12 07:33:08 UTC
Verified with 1.4 M5 RC3.

Git rev: master/fe336b149552b1f4f24d979c40302653298b98cc