Skip to content

Instantly share code, notes, and snippets.

@stefanor
Created March 30, 2013 19:06
Show Gist options
  • Save stefanor/5277952 to your computer and use it in GitHub Desktop.
Save stefanor/5277952 to your computer and use it in GitHub Desktop.
pypy
============================================================================= FAILURES ==============================================================================
__________________________________________________________________________ test_longdouble __________________________________________________________________________
def test_longdouble():
ffi = FFI()
ffi.cdef("long double sinl(long double x);")
lib = ffi.verify('#include <math.h>')
for input in [1.23,
ffi.cast("double", 1.23),
ffi.cast("long double", 1.23)]:
x = lib.sinl(input)
assert repr(x).startswith("<cdata 'long double'")
> assert (float(x) - math.sin(1.23)) < 1E-10
E assert (1.23 - 0.9424888019316975) < 1e-10
E + where 1.23 = float(<cdata 'long double' 1.230000E+00>)
E + and 0.9424888019316975 = <built-in function sin>(1.23)
E + where <built-in function sin> = math.sin
testing/test_verify.py:109: AssertionError
__________________________________________________________________________ test_longdouble __________________________________________________________________________
def test_longdouble():
ffi = FFI()
ffi.cdef("long double sinl(long double x);")
lib = ffi.verify('#include <math.h>')
for input in [1.23,
ffi.cast("double", 1.23),
ffi.cast("long double", 1.23)]:
x = lib.sinl(input)
assert repr(x).startswith("<cdata 'long double'")
> assert (float(x) - math.sin(1.23)) < 1E-10
E assert (1.23 - 0.9424888019316975) < 1e-10
E + where 1.23 = float(<cdata 'long double' 1.230000E+00>)
E + and 0.9424888019316975 = <built-in function sin>(1.23)
E + where <built-in function sin> = math.sin
testing/test_verify.py:109: AssertionError
========================================================= 2 failed, 935 passed, 51 skipped in 46.41 seconds =========================================================
$ PYTHONPATH=../codespeak-lib-1.4.12:../ply-3.4:../pycparser-2.07+dfsg:../python-virtualenv-1.7.1.2:build/lib.linux-sparc64-2.7/ python ../pytest-2.2.4/pytest.py testing/test_verify.py -k test_longdouble
======================================================================== test session starts ========================================================================
platform linux2 -- Python 2.7.3 -- pytest-2.2.4
collected 108 items
testing/test_verify.py Illegal instruction
Starting program: /usr/bin/python -c from\ test\ import\ sinl\;\ sinl\(1\)
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/sparc-linux-gnu/libthread_db.so.1".
Program received signal SIGILL, Illegal instruction.
0xf7fb4ce4 in _cffi_f_sinl (self=0x0, arg0=1) at test.c:167
167 { result = sinl(x0); }
(gdb) bt
#0 0xf7fb4ce4 in _cffi_f_sinl (self=0x0, arg0=1) at test.c:167
#1 0x000e9880 in call_function (oparg=<optimized out>, pp_stack=0xffffd4c4) at ../Python/ceval.c:4009
#2 PyEval_EvalFrameEx (f=<optimized out>, throwflag=<optimized out>) at ../Python/ceval.c:2666
#3 0x000eb1c4 in PyEval_EvalCodeEx (co=0xf7bf1968, globals=<optimized out>, locals=<optimized out>, args=<optimized out>, argcount=<optimized out>,
kws=<optimized out>, kwcount=0, defs=0x0, defcount=0, closure=0x0) at ../Python/ceval.c:3253
#4 0x000eb350 in PyEval_EvalCode (co=0xf7bf1968, globals=
{'__builtins__': <module at remote 0xf7c8e710>, '__name__': '__main__', 'sinl': <built-in function sinl>, '__doc__': None, '__package__': None}, locals=
{'__builtins__': <module at remote 0xf7c8e710>, '__name__': '__main__', 'sinl': <built-in function sinl>, '__doc__': None, '__package__': None})
at ../Python/ceval.c:667
#5 0x00112348 in run_mod (arena=0x2f0be0, flags=<optimized out>, locals=
{'__builtins__': <module at remote 0xf7c8e710>, '__name__': '__main__', 'sinl': <built-in function sinl>, '__doc__': None, '__package__': None}, globals=
{'__builtins__': <module at remote 0xf7c8e710>, '__name__': '__main__', 'sinl': <built-in function sinl>, '__doc__': None, '__package__': None}, filename=
0x1845b0 "<string>", mod=<optimized out>) at ../Python/pythonrun.c:1365
#6 PyRun_StringFlags (flags=<optimized out>, locals=
{'__builtins__': <module at remote 0xf7c8e710>, '__name__': '__main__', 'sinl': <built-in function sinl>, '__doc__': None, '__package__': None}, globals=
{'__builtins__': <module at remote 0xf7c8e710>, '__name__': '__main__', 'sinl': <built-in function sinl>, '__doc__': None, '__package__': None}, start=257, str=
0x2b4008 "from test import sinl; sinl(1)\n") at ../Python/pythonrun.c:1328
#7 PyRun_SimpleStringFlags (command=0x2b4008 "from test import sinl; sinl(1)\n", flags=<optimized out>) at ../Python/pythonrun.c:969
#8 0x00125ed8 in Py_Main (argc=3, argv=0xffffd7e4) at ../Modules/main.c:583
#9 0xf7cd4e54 in __libc_start_main (main=0x21d00 <main>, argc=3, ubp_av=0xffffd7e4, init=<optimized out>, fini=0x1842c0 <__libc_csu_fini>, rtld_fini=0xf7fd9660,
stack_end=0xffffd8e2) at libc-start.c:228
#10 0x00021d54 in _start ()
(gdb) p x0
$1 = 1
(gdb) disas 0xf7fb4ce4
Dump of assembler code for function _cffi_f_sinl:
0xf7fb4be8 <+0>: save %sp, -168, %sp
0xf7fb4bec <+4>: st %i0, [ %fp + 0x44 ]
0xf7fb4bf0 <+8>: st %i1, [ %fp + 0x48 ]
0xf7fb4bf4 <+12>: sethi %hi(0xf7fc5000), %g1
0xf7fb4bf8 <+16>: or %g1, 0x68, %g1 ! 0xf7fc5068 <_cffi_exports>
0xf7fb4bfc <+20>: ld [ %g1 + 0x54 ], %g1
0xf7fb4c00 <+24>: add %fp, -56, %g2
0xf7fb4c04 <+28>: st %g2, [ %sp + 0x40 ]
0xf7fb4c08 <+32>: ld [ %fp + 0x48 ], %o0
0xf7fb4c0c <+36>: call %g1
0xf7fb4c10 <+40>: nop
0xf7fb4c14 <+44>: illtrap 0x10
0xf7fb4c18 <+48>: ldd [ %fp + -56 ], %i2
0xf7fb4c1c <+52>: ldd [ %fp + -48 ], %i4
0xf7fb4c20 <+56>: std %i2, [ %fp + -16 ]
0xf7fb4c24 <+60>: std %i4, [ %fp + -8 ]
0xf7fb4c28 <+64>: ldd [ %fp + -16 ], %o2
0xf7fb4c2c <+68>: ldd [ %fp + -8 ], %o4
0xf7fb4c30 <+72>: sethi %hi(0xf7fb4c00), %g1
0xf7fb4c34 <+76>: or %g1, 0x2b8, %g1 ! 0xf7fb4eb8
0xf7fb4c38 <+80>: ldd [ %g1 ], %i2
0xf7fb4c3c <+84>: ldd [ %g1 + 8 ], %i4
0xf7fb4c40 <+88>: std %o2, [ %fp + -56 ]
0xf7fb4c44 <+92>: std %o4, [ %fp + -48 ]
0xf7fb4c48 <+96>: add %fp, -56, %g2
0xf7fb4c4c <+100>: std %i2, [ %fp + -72 ]
0xf7fb4c50 <+104>: std %i4, [ %fp + -64 ]
0xf7fb4c54 <+108>: add %fp, -72, %g1
0xf7fb4c58 <+112>: mov %g2, %o0
0xf7fb4c5c <+116>: mov %g1, %o1
0xf7fb4c60 <+120>: call 0xf7deb840 <_Q_fne>
0xf7fb4c64 <+124>: nop
0xf7fb4c68 <+128>: mov %o0, %g1
0xf7fb4c6c <+132>: cmp %g1, 0
0xf7fb4c70 <+136>: bne %icc, 0xf7fb4c9c <_cffi_f_sinl+180>
0xf7fb4c74 <+140>: nop
0xf7fb4c78 <+144>: call 0xfa240
0xf7fb4c7c <+148>: nop
0xf7fb4c80 <+152>: mov %o0, %g1
0xf7fb4c84 <+156>: cmp %g1, 0
0xf7fb4c88 <+160>: be %icc, 0xf7fb4c9c <_cffi_f_sinl+180>
0xf7fb4c8c <+164>: nop
0xf7fb4c90 <+168>: clr %g1 ! 0x0
0xf7fb4c94 <+172>: b %xcc, 0xf7fb4d50 <_cffi_f_sinl+360>
0xf7fb4c98 <+176>: nop
0xf7fb4c9c <+180>: call 0xe2d60
---Type <return> to continue, or q <return> to quit---
0xf7fb4ca0 <+184>: nop
0xf7fb4ca4 <+188>: st %o0, [ %fp + -20 ]
0xf7fb4ca8 <+192>: sethi %hi(0xf7fc5000), %g1
0xf7fb4cac <+196>: or %g1, 0x68, %g1 ! 0xf7fc5068 <_cffi_exports>
0xf7fb4cb0 <+200>: ld [ %g1 + 0x34 ], %g1
0xf7fb4cb4 <+204>: call %g1
0xf7fb4cb8 <+208>: nop
0xf7fb4cbc <+212>: ldd [ %fp + -16 ], %i2
0xf7fb4cc0 <+216>: ldd [ %fp + -8 ], %i4
0xf7fb4cc4 <+220>: std %i2, [ %fp + -72 ]
0xf7fb4cc8 <+224>: std %i4, [ %fp + -64 ]
0xf7fb4ccc <+228>: add %fp, -72, %g1
0xf7fb4cd0 <+232>: add %fp, -56, %g2
0xf7fb4cd4 <+236>: st %g2, [ %sp + 0x40 ]
0xf7fb4cd8 <+240>: mov %g1, %o0
0xf7fb4cdc <+244>: call 0xf7e68980 <__sin>
0xf7fb4ce0 <+248>: nop
=> 0xf7fb4ce4 <+252>: illtrap 0x10
0xf7fb4ce8 <+256>: ldd [ %fp + -56 ], %i2
0xf7fb4cec <+260>: ldd [ %fp + -48 ], %i4
0xf7fb4cf0 <+264>: std %i2, [ %fp + -40 ]
0xf7fb4cf4 <+268>: std %i4, [ %fp + -32 ]
0xf7fb4cf8 <+272>: sethi %hi(0xf7fc5000), %g1
0xf7fb4cfc <+276>: or %g1, 0x68, %g1 ! 0xf7fc5068 <_cffi_exports>
0xf7fb4d00 <+280>: ld [ %g1 + 0x38 ], %g1
0xf7fb4d04 <+284>: call %g1
0xf7fb4d08 <+288>: nop
0xf7fb4d0c <+292>: ld [ %fp + -20 ], %o0
0xf7fb4d10 <+296>: call 0xe2dc0
0xf7fb4d14 <+300>: nop
0xf7fb4d18 <+304>: sethi %hi(0xf7fc5000), %g1
0xf7fb4d1c <+308>: or %g1, 0x68, %g1 ! 0xf7fc5068 <_cffi_exports>
0xf7fb4d20 <+312>: ld [ %g1 + 0x40 ], %g1
0xf7fb4d24 <+316>: sethi %hi(0xf7fc5000), %g2
0xf7fb4d28 <+320>: or %g2, 0xcc, %g2 ! 0xf7fc50cc <_cffi_types>
0xf7fb4d2c <+324>: ld [ %g2 ], %g2
0xf7fb4d30 <+328>: ld [ %g2 + 0xc ], %g2
0xf7fb4d34 <+332>: ld [ %g2 ], %g2
0xf7fb4d38 <+336>: add %fp, -40, %g3
0xf7fb4d3c <+340>: mov %g3, %o0
0xf7fb4d40 <+344>: mov %g2, %o1
0xf7fb4d44 <+348>: call %g1
0xf7fb4d48 <+352>: nop
0xf7fb4d4c <+356>: mov %o0, %g1
0xf7fb4d50 <+360>: mov %g1, %i0
0xf7fb4d54 <+364>: rett %i7 + 8
0xf7fb4d58 <+368>: nop
---Type <return> to continue, or q <return> to quit---
End of assembler dump.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment