[pypy-commit] pypy default: ANSI C doesn't allow 'p + n' if p is declared as 'void *'.
arigo
noreply at buildbot.pypy.org
Mon Aug 13 22:51:59 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r56722:9e9b39337354
Date: 2012-08-13 22:51 +0200
http://bitbucket.org/pypy/pypy/changeset/9e9b39337354/
Log: ANSI C doesn't allow 'p + n' if p is declared as 'void *'.
diff --git a/pypy/translator/c/funcgen.py b/pypy/translator/c/funcgen.py
--- a/pypy/translator/c/funcgen.py
+++ b/pypy/translator/c/funcgen.py
@@ -704,8 +704,9 @@
value = self.expr(op.args[2])
TYPE = op.args[2].concretetype
typename = cdecl(self.db.gettype(TYPE).replace('@', '*@'), '')
- return ('((%(typename)s) (%(addr)s + %(offset)s))[0] = %(value)s;' %
- locals())
+ return (
+ '((%(typename)s) (((char *)%(addr)s) + %(offset)s))[0] = %(value)s;'
+ % locals())
def OP_RAW_LOAD(self, op):
addr = self.expr(op.args[0])
@@ -713,8 +714,9 @@
result = self.expr(op.result)
TYPE = op.result.concretetype
typename = cdecl(self.db.gettype(TYPE).replace('@', '*@'), '')
- return ("%(result)s = ((%(typename)s) (%(addr)s + %(offset)s))[0];" %
- locals())
+ return (
+ "%(result)s = ((%(typename)s) (((char *)%(addr)s) + %(offset)s))[0];"
+ % locals())
def OP_CAST_PRIMITIVE(self, op):
TYPE = self.lltypemap(op.result)
More information about the pypy-commit
mailing list