[pypy-svn] pypy jit-longlong: Fix for gcc, which used to give the warning "dereferencing
arigo
commits-noreply at bitbucket.org
Tue Jan 25 18:00:48 CET 2011
Author: Armin Rigo <arigo at tunes.org>
Branch: jit-longlong
Changeset: r41318:8580571213d2
Date: 2011-01-24 19:19 +0100
http://bitbucket.org/pypy/pypy/changeset/8580571213d2/
Log: Fix for gcc, which used to give the warning "dereferencing type-
punned pointer will break strict-aliasing rules" and possibly
produce wrong code.
diff --git a/pypy/rlib/longlong2float.py b/pypy/rlib/longlong2float.py
--- a/pypy/rlib/longlong2float.py
+++ b/pypy/rlib/longlong2float.py
@@ -29,10 +29,12 @@
from pypy.translator.tool.cbuild import ExternalCompilationInfo
eci = ExternalCompilationInfo(post_include_bits=["""
static double pypy__longlong2float(long long x) {
- return *((double*)&x);
+ char *p = (char*)&x;
+ return *((double*)p);
}
static long long pypy__float2longlong(double x) {
- return *((long long*)&x);
+ char *p = (char*)&x;
+ return *((long long*)p);
}
"""])
More information about the Pypy-commit
mailing list