cvc4: patch up fpu_control usage

+70
+5
pkgs/applications/science/logic/cvc4/default.nix
··· 22 "--with-boost=${boost.dev}" 23 ]; 24 25 preConfigure = '' 26 patchShebangs ./src/ 27 '';
··· 22 "--with-boost=${boost.dev}" 23 ]; 24 25 + prePatch = '' 26 + patch -p1 -i ${./minisat-fenv.patch} -d src/prop/minisat 27 + patch -p1 -i ${./minisat-fenv.patch} -d src/prop/bvminisat 28 + ''; 29 + 30 preConfigure = '' 31 patchShebangs ./src/ 32 '';
+65
pkgs/applications/science/logic/cvc4/minisat-fenv.patch
···
··· 1 + From 7f1016ceab9b0f57a935bd51ca6df3d18439b472 Mon Sep 17 00:00:00 2001 2 + From: Will Dietz <w@wdtz.org> 3 + Date: Tue, 17 Oct 2017 22:57:02 -0500 4 + Subject: [PATCH] use fenv instead of non-standard fpu_control 5 + 6 + --- 7 + core/Main.cc | 8 ++++++-- 8 + simp/Main.cc | 8 ++++++-- 9 + utils/System.h | 2 +- 10 + 3 files changed, 13 insertions(+), 5 deletions(-) 11 + 12 + diff --git a/core/Main.cc b/core/Main.cc 13 + index 2b0d97b..8ad95fb 100644 14 + --- a/core/Main.cc 15 + +++ b/core/Main.cc 16 + @@ -78,8 +78,12 @@ int main(int argc, char** argv) 17 + // printf("This is MiniSat 2.0 beta\n"); 18 + 19 + #if defined(__linux__) 20 + - fpu_control_t oldcw, newcw; 21 + - _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw); 22 + + fenv_t fenv; 23 + + 24 + + fegetenv(&fenv); 25 + + fenv.__control_word &= ~0x300; /* _FPU_EXTENDED */ 26 + + fenv.__control_word |= 0x200; /* _FPU_DOUBLE */ 27 + + fesetenv(&fenv); 28 + printf("WARNING: for repeatability, setting FPU to use double precision\n"); 29 + #endif 30 + // Extra options: 31 + diff --git a/simp/Main.cc b/simp/Main.cc 32 + index 2804d7f..39bfb71 100644 33 + --- a/simp/Main.cc 34 + +++ b/simp/Main.cc 35 + @@ -79,8 +79,12 @@ int main(int argc, char** argv) 36 + // printf("This is MiniSat 2.0 beta\n"); 37 + 38 + #if defined(__linux__) 39 + - fpu_control_t oldcw, newcw; 40 + - _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw); 41 + + fenv_t fenv; 42 + + 43 + + fegetenv(&fenv); 44 + + fenv.__control_word &= ~0x300; /* _FPU_EXTENDED */ 45 + + fenv.__control_word |= 0x200; /* _FPU_DOUBLE */ 46 + + fesetenv(&fenv); 47 + printf("WARNING: for repeatability, setting FPU to use double precision\n"); 48 + #endif 49 + // Extra options: 50 + diff --git a/utils/System.h b/utils/System.h 51 + index 1758192..c0ad13a 100644 52 + --- a/utils/System.h 53 + +++ b/utils/System.h 54 + @@ -22,7 +22,7 @@ OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWA 55 + #define Minisat_System_h 56 + 57 + #if defined(__linux__) 58 + -#include <fpu_control.h> 59 + +#include <fenv.h> 60 + #endif 61 + 62 + #include "mtl/IntTypes.h" 63 + -- 64 + 2.14.2 65 +