Package: flint / 2.5.2-19

asm_volatile_div.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Description: Add __volatile__ to asm(div)
 This fixes the flint-arb issue on amd64 and i386. If that appears on other
 architectures, then we need to also patch the asm(div)s for other arches.
 .
 See the GCC bug for a detailed explanation of this patch.
 .
 A more complete version of this patch is being discussed with GMP devs,
 which will need to be upstreamed to FLINT when finalised:
Author: Ximin Luo <infinity0@debian.org>
Bug: https://github.com/fredrik-johansson/arb/issues/194
Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82677#c9
Bug: https://gmplib.org/list-archives/gmp-bugs/2017-October/004231.html
Bug: https://gmplib.org/list-archives/gmp-bugs/2017-November/004235.html
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/longlong.h
+++ b/longlong.h
@@ -65,12 +65,12 @@
        : "%0" ((mp_limb_t)(u)), "rm" ((mp_limb_t)(v)))
 
 #define udiv_qrnnd(q, r, n1, n0, dx)                                            \
-  __asm__ ("divq %4"                                                            \
+  __asm__ __volatile__ ("divq %4"                                                            \
        : "=a" (q), "=d" (r)                                                     \
        : "0" ((mp_limb_t)(n0)), "1" ((mp_limb_t)(n1)), "rm" ((mp_limb_t)(dx)))
 
 #define sdiv_qrnnd(q, r, n1, n0, dx)                                            \
-  __asm__ ("idivq %4"                                                           \
+  __asm__ __volatile__ ("idivq %4"                                                           \
        : "=a" (q), "=d" (r)                                                     \
        : "0" ((mp_limb_t)(n0)), "1" ((mp_limb_t)(n1)), "rm" ((mp_limb_t)(dx)))
 
@@ -122,12 +122,12 @@
        : "%0" ((mp_limb_t)(u)), "rm" ((mp_limb_t)(v)))
 
 #define udiv_qrnnd(q, r, n1, n0, dx)                                            \
-  __asm__ ("divl %4"                                                            \
+  __asm__ __volatile__ ("divl %4"                                                            \
        : "=a" (q), "=d" (r)                                                     \
        : "0" ((mp_limb_t)(n0)), "1" ((mp_limb_t)(n1)), "rm" ((mp_limb_t)(dx)))
 
 #define sdiv_qrnnd(q, r, n1, n0, dx)                                            \
-  __asm__ ("idivl %4"                                                           \
+  __asm__ __volatile__ ("idivl %4"                                                           \
        : "=a" (q), "=d" (r)                                                     \
        : "0" ((mp_limb_t)(n0)), "1" ((mp_limb_t)(n1)), "rm" ((mp_limb_t)(dx)))