summary refs log tree commit diff
path: root/sysdeps/i386
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2016-06-08 21:02:40 +0000
committerJoseph Myers <joseph@codesourcery.com>2016-06-08 21:02:40 +0000
commit40720ec9f98d57214d73d6fa98019e684f2eb45a (patch)
tree2c73ae577c76260bc804a986f638f67f5ef429c0 /sysdeps/i386
parentc867597bff2562180a18da4b8dba89d24e8b65c4 (diff)
downloadglibc-40720ec9f98d57214d73d6fa98019e684f2eb45a.tar.gz
glibc-40720ec9f98d57214d73d6fa98019e684f2eb45a.tar.xz
glibc-40720ec9f98d57214d73d6fa98019e684f2eb45a.zip
Fix i386 cbrtl (sNaN) (bug 20224).
The i386 version of cbrtl returns sNaN (without raising any
exceptions) for sNaN input.  This patch fixes it to add non-finite
arguments to themselves (the code path in question is also reached for
zero arguments, for which adding them to themselves is also harmless),
so that "invalid" is raised and qNaN returned.

Tested for x86_64 and x86.

	[BZ #20224]
	* sysdeps/i386/fpu/s_cbrtl.S (__cbrtl): Add non-finite or zero
	argument to itself.
	* math/libm-test.inc (cbrt_test_data): Add sNaN tests.
Diffstat (limited to 'sysdeps/i386')
-rw-r--r--sysdeps/i386/fpu/s_cbrtl.S1
1 files changed, 1 insertions, 0 deletions
diff --git a/sysdeps/i386/fpu/s_cbrtl.S b/sysdeps/i386/fpu/s_cbrtl.S
index 3bf170075b..6a64313165 100644
--- a/sysdeps/i386/fpu/s_cbrtl.S
+++ b/sysdeps/i386/fpu/s_cbrtl.S
@@ -223,6 +223,7 @@ ENTRY(__cbrtl)
 
 	/* Return the argument.  */
 1:	fldt	4(%esp)
+	fadd	%st
 	ret
 END(__cbrtl)
 weak_alias (__cbrtl, cbrtl)