[pypy-dev] PyPy3: Translation issue: "TyperError: arithmetic not supported on <INT>, its size is too small"

David Naylor naylor.b.david at gmail.com
Sun Jul 24 07:45:26 EDT 2016


Hi

While translating the latest version of pypy3 on FreeBSD (and after applying 
the fix for https://bitbucket.org/pypy/pypy/issues/2348) I get the following 
error:

File "/usr/local/home/dbn/ports/ports/lang/pypy3/work/pypy3.3-v5.2.0-alpha1-
src/rpython/rtyper/rint.py", line 25, in opprefix
    self.lowleveltype)
[translation:ERROR] TyperError: arithmetic not supported on <INT>, its size is 
too small
.. (pypy.module.time.interp_time:988)clock
.. block at 3 with 2 exits(v1573)
.. v1575 = eq(value_25, v1574)

The error occurs when translating pypy/module/time/interp_time, line 996:

        if value == rffi.cast(clock_t, -1):

Although this can be easily fixed by casting value to r_int instead, it then 
causes another issue on line 969:

        cpu_time = float(tms.c_tms_utime + tms.c_tms_stime)

Again, same issue of TyperError with <INT> (this time, instead of with clock_t 
[1][2] but with TMS.tms_utime [3]).  

I have been unable to figure out how a 
rpython.rtyper.lltypesystem.lltype.Number (which a believe an INT is) gets 
converted into a rpython.rtyper.rint.IntegerRepr, or why it gets converted 
without an opprefix set.  

Any suggestions how to fix this issue, or what the root cause is, will be 
greatly appreciated.  

Regards

David

[1] clock_t is defined, in platcheck_73 as:
-+- clock_t
size: 4
unsigned: 0
---
[2] On FreeBSD clock_t is typedef as unsigned long.
[3] TMS is defined in platcheck_7 as:
-+- TMS
align: 4
size: 16
fldofs tms_utime: 0
fldsize tms_utime: 4
fldunsigned tms_utime: 0
fldofs tms_stime: 4
fldsize tms_stime: 4
fldunsigned tms_stime: 0
fldofs tms_cutime: 8
fldsize tms_cutime: 4
fldunsigned tms_cutime: 0
fldofs tms_cstime: 12
fldsize tms_cstime: 4
fldunsigned tms_cstime: 0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20160724/4d2b49a6/attachment.sig>


More information about the pypy-dev mailing list