[pypy-commit] pypy default: avoid void* arithmetic by changing vp += val to vp = (char*)vp + v, fix win32?

mattip pypy.commits at gmail.com
Tue May 21 00:53:42 EDT 2019


Author: Matti Picus <matti.picus at gmail.com>
Branch: 
Changeset: r96650:1939f3b020f8
Date: 2019-05-21 06:53 +0300
http://bitbucket.org/pypy/pypy/changeset/1939f3b020f8/

Log:	avoid void* arithmetic by changing vp += val to vp = (char*)vp + v,
	fix win32?

diff --git a/rpython/translator/c/gc.py b/rpython/translator/c/gc.py
--- a/rpython/translator/c/gc.py
+++ b/rpython/translator/c/gc.py
@@ -461,10 +461,12 @@
         raise Exception("gc_pop_roots should be removed by postprocess_graph")
 
     def OP_GC_ENTER_ROOTS_FRAME(self, funcgen, op):
-        return '(%s) += sizeof(pypy_ss_t);' % (funcgen.gcpol_ss,)
+        # avoid arithmatic on void*
+        return '({0}) = (char*)({0}) + sizeof(pypy_ss_t);'.format(funcgen.gcpol_ss,)
 
     def OP_GC_LEAVE_ROOTS_FRAME(self, funcgen, op):
-        return '(%s) -= sizeof(pypy_ss_t);' % (funcgen.gcpol_ss,)
+        # avoid arithmatic on void*
+        return '({0}) = (char*)({0}) - sizeof(pypy_ss_t);'.format(funcgen.gcpol_ss,)
 
     def OP_GC_SAVE_ROOT(self, funcgen, op):
         num = op.args[0].value


More information about the pypy-commit mailing list