Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r3160:3184b0a675fc
Date: 2018-09-13 13:51 +0200
http://bitbucket.org/cffi/cffi/changeset/3184b0a675fc/

Log:    Issue 378

        Workaround for a GCC bug

diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -892,11 +892,21 @@
     return 0;
 }
 
+#ifdef __GNUC__
+/* This is a workaround for what I think is a GCC bug on several
+   platforms.  See issue #378. */
+__attribute__((noinline))
+#endif
+void _cffi_memcpy(char *target, const void *src, size_t size)
+{
+    memcpy(target, src, size);
+}
+
 #define _write_raw_data(type)                           \
     do {                                                \
         if (size == sizeof(type)) {                     \
             type r = (type)source;                      \
-            memcpy(target, &r, sizeof(type));           \
+            _cffi_memcpy(target, &r, sizeof(type));           \
             return;                                     \
         }                                               \
     } while(0)
@@ -970,8 +980,8 @@
         if (size == 2*sizeof(type)) {                      \
             type r = (type)source.real;                    \
             type i = (type)source.imag;                    \
-            memcpy(target, &r, sizeof(type));              \
-            memcpy(target+sizeof(type), &i, sizeof(type)); \
+            _cffi_memcpy(target, &r, sizeof(type));              \
+            _cffi_memcpy(target+sizeof(type), &i, sizeof(type)); \
             return;                                        \
         }                                                  \
     } while(0)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to