44 lines
1.5 KiB
Diff
44 lines
1.5 KiB
Diff
|
From: Jan Engelhardt <jengelh@inai.de>
|
||
|
Date: 2022-04-14 16:00:12.633272404 +0200
|
||
|
|
||
|
Modeled upon a similar patch for opensuse's ICU package.
|
||
|
|
||
|
---
|
||
|
configure.ac | 4 ++--
|
||
|
src/include/fst/float-weight.h | 4 +++-
|
||
|
2 files changed, 5 insertions(+), 3 deletions(-)
|
||
|
|
||
|
Index: openfst-1.8.2/configure.ac
|
||
|
===================================================================
|
||
|
--- openfst-1.8.2.orig/configure.ac
|
||
|
+++ openfst-1.8.2/configure.ac
|
||
|
@@ -156,11 +156,11 @@ AC_RUN_IFELSE([AC_LANG_PROGRAM([
|
||
|
#include <cstdio>
|
||
|
|
||
|
template <typename T>
|
||
|
- bool FloatEqIsReflexive(T m) {
|
||
|
+ bool FloatEqIsReflexive(volatile T m) {
|
||
|
volatile T x = 1.111;
|
||
|
x *= m;
|
||
|
|
||
|
- T y = 1.111;
|
||
|
+ volatile T y = 1.111;
|
||
|
y *= m;
|
||
|
|
||
|
return x == y;
|
||
|
Index: openfst-1.8.2/src/include/fst/float-weight.h
|
||
|
===================================================================
|
||
|
--- openfst-1.8.2.orig/src/include/fst/float-weight.h
|
||
|
+++ openfst-1.8.2/src/include/fst/float-weight.h
|
||
|
@@ -117,7 +117,9 @@ constexpr bool operator==(const FloatWei
|
||
|
// register may cause it to compare unequal to that same weight when
|
||
|
// stored to memory. This breaks =='s reflexivity, in turn breaking
|
||
|
// NaturalLess.
|
||
|
-#error "Please compile with -msse -mfpmath=sse, or equivalent."
|
||
|
+// So, store it in memory.
|
||
|
+ volatile T a = w1.Value(), b = w2.Value();
|
||
|
+ return a == b;
|
||
|
#endif
|
||
|
return w1.Value() == w2.Value();
|
||
|
}
|