public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/16625] New: sin gives wrong result with 2.19 on i386
@ 2014-02-22 14:50 jtaylor.debian at googlemail dot com
  2014-02-22 14:57 ` [Bug libc/16625] " jtaylor.debian at googlemail dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: jtaylor.debian at googlemail dot com @ 2014-02-22 14:50 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16625

            Bug ID: 16625
           Summary: sin gives wrong result with 2.19 on i386
           Product: glibc
           Version: 2.19
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: jtaylor.debian at googlemail dot com
                CC: drepper.fsp at gmail dot com

in ubuntu 14.04 i386 with glibc2.19 we are seeing wrong results for calls to
sin that don't appear with 2.18:
https://launchpadlibrarian.net/167193519/buildlog_ubuntu-trusty-i386.python-cffi_0.8.1-1ubuntu3_FAILEDTOBUILD.txt.gz


>       assert library.sin(12.3) == math.sin(12.3)
E       assert 0.8444952930965295 == -0.26323179136580094

I failed to create a testcase for as it seems to depend on global state.

to reproduce via the packages in 14.04 o

apt-get source python-cffi
cd python-cffi*
apt-get build-dep python-cffi
gdb --args python2.7 -m pytest testing/test_function.py
testing/test_zdistutils.py

from what I can tell with my limited assembly skills is that it computes the
right result but clobbers it in libc_feresetround_387_ctx

0xf7da2028 in libc_feresetround_387_ctx (ctx=0xffffa0a0) at
../sysdeps/i386/fpu/fenv_private.h:452
452      if (__glibc_unlikely (ctx->updated_status))
3: $st2 = 0.26251239976915330398554715429781936
2: $st1 = 7.2970669792260636173761756580191662e-08
1: $st0 = 0.84449529309652948683151407749392092


$st2 contains the right result, but its not returned to $st0 after the function
returns so cffi gets the wrong result.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libc/16625] sin gives wrong result with 2.19 on i386
  2014-02-22 14:50 [Bug libc/16625] New: sin gives wrong result with 2.19 on i386 jtaylor.debian at googlemail dot com
@ 2014-02-22 14:57 ` jtaylor.debian at googlemail dot com
  2014-02-22 16:53 ` adconrad at 0c3 dot net
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jtaylor.debian at googlemail dot com @ 2014-02-22 14:57 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16625

--- Comment #1 from Julian Taylor <jtaylor.debian at googlemail dot com> ---
hm no $st2 does not contain the right result but its related to the rounding
context
retval in ../sysdeps/ieee754/dbl-64/s_sin.c:391 does contain the result, after
that it jumps to the rounding context after which the result is wrong.

some better debugging instructions for cffi:
gdb --args python2.7 -m pytest testing/test_function.py
testing/test_zdistutils.py
break sin
# calls sin 8 times with before it x=1.23 reaches the problematic case of
x=12.3
ignore 1 8

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libc/16625] sin gives wrong result with 2.19 on i386
  2014-02-22 14:50 [Bug libc/16625] New: sin gives wrong result with 2.19 on i386 jtaylor.debian at googlemail dot com
  2014-02-22 14:57 ` [Bug libc/16625] " jtaylor.debian at googlemail dot com
@ 2014-02-22 16:53 ` adconrad at 0c3 dot net
  2014-02-24 14:30 ` schwab@linux-m68k.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: adconrad at 0c3 dot net @ 2014-02-22 16:53 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16625

Adam Conrad <adconrad at 0c3 dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |adconrad at 0c3 dot net,
                   |                            |jsm28 at gcc dot gnu.org

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libc/16625] sin gives wrong result with 2.19 on i386
  2014-02-22 14:50 [Bug libc/16625] New: sin gives wrong result with 2.19 on i386 jtaylor.debian at googlemail dot com
  2014-02-22 14:57 ` [Bug libc/16625] " jtaylor.debian at googlemail dot com
  2014-02-22 16:53 ` adconrad at 0c3 dot net
@ 2014-02-24 14:30 ` schwab@linux-m68k.org
  2014-02-24 21:28 ` jtaylor.debian at googlemail dot com
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: schwab@linux-m68k.org @ 2014-02-24 14:30 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=16625

--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> ---
I'm unable to reproduce that.  Compiler bug?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libc/16625] sin gives wrong result with 2.19 on i386
  2014-02-22 14:50 [Bug libc/16625] New: sin gives wrong result with 2.19 on i386 jtaylor.debian at googlemail dot com
                   ` (2 preceding siblings ...)
  2014-02-24 14:30 ` schwab@linux-m68k.org
@ 2014-02-24 21:28 ` jtaylor.debian at googlemail dot com
  2014-03-04 22:30 ` jtaylor.debian at googlemail dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jtaylor.debian at googlemail dot com @ 2014-02-24 21:28 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16625

--- Comment #3 from Julian Taylor <jtaylor.debian at googlemail dot com> ---
possible, I just rebuilt the packaged libc with -Og instead of -O2 and the
issue disappears...
the compiler I use is is 4.8.2-16ubuntu2 20140221 (r208010) from the
gcc-4_8-branch.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libc/16625] sin gives wrong result with 2.19 on i386
  2014-02-22 14:50 [Bug libc/16625] New: sin gives wrong result with 2.19 on i386 jtaylor.debian at googlemail dot com
                   ` (3 preceding siblings ...)
  2014-02-24 21:28 ` jtaylor.debian at googlemail dot com
@ 2014-03-04 22:30 ` jtaylor.debian at googlemail dot com
  2014-03-04 22:48 ` jtaylor.debian at googlemail dot com
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jtaylor.debian at googlemail dot com @ 2014-03-04 22:30 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16625

--- Comment #4 from Julian Taylor <jtaylor.debian at googlemail dot com> ---
I have bisected the issue to this commit:

commit 392dd2de03c054b1b32358561570be14f55e9ae9
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Fri Dec 20 16:01:03 2013 +0530

    Consolidate code to compute sin and cos from lookup tables

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libc/16625] sin gives wrong result with 2.19 on i386
  2014-02-22 14:50 [Bug libc/16625] New: sin gives wrong result with 2.19 on i386 jtaylor.debian at googlemail dot com
                   ` (4 preceding siblings ...)
  2014-03-04 22:30 ` jtaylor.debian at googlemail dot com
@ 2014-03-04 22:48 ` jtaylor.debian at googlemail dot com
  2014-03-04 23:06 ` jtaylor.debian at googlemail dot com
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jtaylor.debian at googlemail dot com @ 2014-03-04 22:48 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16625

--- Comment #5 from Julian Taylor <jtaylor.debian at googlemail dot com> ---
but building the commit with gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-11ubuntu1)
fixes it again, really does smell like a compiler bug

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libc/16625] sin gives wrong result with 2.19 on i386
  2014-02-22 14:50 [Bug libc/16625] New: sin gives wrong result with 2.19 on i386 jtaylor.debian at googlemail dot com
                   ` (5 preceding siblings ...)
  2014-03-04 22:48 ` jtaylor.debian at googlemail dot com
@ 2014-03-04 23:06 ` jtaylor.debian at googlemail dot com
  2014-03-05  0:59 ` adconrad at 0c3 dot net
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jtaylor.debian at googlemail dot com @ 2014-03-04 23:06 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16625

--- Comment #6 from Julian Taylor <jtaylor.debian at googlemail dot com> ---
gcc-4.9 (Ubuntu 4.9-20140303-0ubuntu3) 4.9.0 20140304 (experimental) [trunk
revision 208299] works too, so its just 4.8.2 thats broken

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libc/16625] sin gives wrong result with 2.19 on i386
  2014-02-22 14:50 [Bug libc/16625] New: sin gives wrong result with 2.19 on i386 jtaylor.debian at googlemail dot com
                   ` (6 preceding siblings ...)
  2014-03-04 23:06 ` jtaylor.debian at googlemail dot com
@ 2014-03-05  0:59 ` adconrad at 0c3 dot net
  2014-03-09 13:22 ` jtaylor.debian at googlemail dot com
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: adconrad at 0c3 dot net @ 2014-03-05  0:59 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16625

Adam Conrad <adconrad at 0c3 dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |doko at debian dot org

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libc/16625] sin gives wrong result with 2.19 on i386
  2014-02-22 14:50 [Bug libc/16625] New: sin gives wrong result with 2.19 on i386 jtaylor.debian at googlemail dot com
                   ` (7 preceding siblings ...)
  2014-03-05  0:59 ` adconrad at 0c3 dot net
@ 2014-03-09 13:22 ` jtaylor.debian at googlemail dot com
  2014-06-13  8:09 ` fweimer at redhat dot com
  2014-06-17 17:33 ` jsm28 at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jtaylor.debian at googlemail dot com @ 2014-03-09 13:22 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16625

--- Comment #7 from Julian Taylor <jtaylor.debian at googlemail dot com> ---
r204212 of gcc fixes it
http://gcc.gnu.org/ml/gcc-patches/2013-10/msg02422.html

though it seems like an accidental fix be removing the -fregmove pass
building with gcc 4.8.2 and -fno-regmove fixes the issue too.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libc/16625] sin gives wrong result with 2.19 on i386
  2014-02-22 14:50 [Bug libc/16625] New: sin gives wrong result with 2.19 on i386 jtaylor.debian at googlemail dot com
                   ` (8 preceding siblings ...)
  2014-03-09 13:22 ` jtaylor.debian at googlemail dot com
@ 2014-06-13  8:09 ` fweimer at redhat dot com
  2014-06-17 17:33 ` jsm28 at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: fweimer at redhat dot com @ 2014-06-13  8:09 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16625

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Flags|                            |security-

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libc/16625] sin gives wrong result with 2.19 on i386
  2014-02-22 14:50 [Bug libc/16625] New: sin gives wrong result with 2.19 on i386 jtaylor.debian at googlemail dot com
                   ` (9 preceding siblings ...)
  2014-06-13  8:09 ` fweimer at redhat dot com
@ 2014-06-17 17:33 ` jsm28 at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2014-06-17 17:33 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=16625

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #8 from Joseph Myers <jsm28 at gcc dot gnu.org> ---
Resolved as a compiler bug, not a glibc bug.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-06-17 17:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-22 14:50 [Bug libc/16625] New: sin gives wrong result with 2.19 on i386 jtaylor.debian at googlemail dot com
2014-02-22 14:57 ` [Bug libc/16625] " jtaylor.debian at googlemail dot com
2014-02-22 16:53 ` adconrad at 0c3 dot net
2014-02-24 14:30 ` schwab@linux-m68k.org
2014-02-24 21:28 ` jtaylor.debian at googlemail dot com
2014-03-04 22:30 ` jtaylor.debian at googlemail dot com
2014-03-04 22:48 ` jtaylor.debian at googlemail dot com
2014-03-04 23:06 ` jtaylor.debian at googlemail dot com
2014-03-05  0:59 ` adconrad at 0c3 dot net
2014-03-09 13:22 ` jtaylor.debian at googlemail dot com
2014-06-13  8:09 ` fweimer at redhat dot com
2014-06-17 17:33 ` jsm28 at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).