[pypy-issue] Issue #2704: Undefined behavior in RPython via the C backend (pypy/pypy)

Carl Friedrich Bolz-Tereick issues-reply at bitbucket.org
Tue Nov 28 11:00:46 EST 2017

New issue 2704: Undefined behavior in RPython via the C backend

Carl Friedrich Bolz-Tereick:

We did not completely decide so far whether int-addition (and other ops) in RPython must behave a) by wrapping around or b) by having undefined behavior on overflow.

Right now, the C backend and parts of the JIT implements b). However, we definitely have code where we use int operations that overflow and we expect a), most notably a lot of hash computations (eg ``W_TupleObject._descr_hash_*``). This has the potential (maybe unlikely though?) of causing miscompilation of PyPy at any point in the future when GCC (or the JIT) gets smarter about reasoning about ints.

More information about the pypy-issue mailing list