a workardond against https://bitbucket.org/cffi/cffi/issues/378/ (possible bug in GCC, see https://bugzilla.redhat.com/1552724). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cffi?expand=0&rev=50
47 lines
1.7 KiB
Diff
47 lines
1.7 KiB
Diff
# HG changeset patch
|
|
# User Armin Rigo <arigo@tunes.org>
|
|
# Date 1536839482 -7200
|
|
# Node ID 3184b0a675fc425b821b528d7fdf744b2f08dadf
|
|
# Parent 97a61f7b0bcd48eb74f136280ffd8733e829f153
|
|
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)
|