sc/source/core/tool/interpr3.cxx |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 32219f4d88efc5618718a13079ade0561dd0d14b
Author: Eike Rathke <er...@redhat.com>
Date:   Tue May 9 14:40:43 2017 +0200

    Guard against a failure when compiled with optimization using g++ 4.8.2
    
    i.e. Linux-rpm_deb-x86_71-TDF
    
    Change-Id: I4866eda4f87af3fd9b15ab24f549d1a1c6ae4ee7

diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 950648694db6..8937e666c865 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -2822,7 +2822,14 @@ void ScInterpreter::ScChiTest()
                         PushError(FormulaError::DivisionByZero);
                         return;
                     }
-                    fChi += sc::divide( (fValX - fValE) * (fValX - fValE), 
fValE);
+                    // These fTemp values guard against a failure when compiled
+                    // with optimization (using g++ 4.8.2 on tinderbox 71-TDF),
+                    // where ((fValX - fValE) * (fValX - fValE)) with
+                    // fValE==1e+308 should had produced Infinity but did
+                    // not, instead the result of divide() then was 1e+308.
+                    volatile double fTemp1 = (fValX - fValE) * (fValX - fValE);
+                    double fTemp2 = fTemp1;
+                    fChi += sc::divide( fTemp2, fValE);
                 }
                 else
                 {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to