summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-05-09 14:40:43 +0200
committerEike Rathke <erack@redhat.com>2017-05-09 14:51:25 +0200
commit32219f4d88efc5618718a13079ade0561dd0d14b (patch)
tree3092f3503736245f1d326d8bf1df41463e7b1a11 /sc
parentf505f95d466d4d3348f41dfd93e5c243d15c6c71 (diff)
Guard against a failure when compiled with optimization using g++ 4.8.2
i.e. Linux-rpm_deb-x86_71-TDF Change-Id: I4866eda4f87af3fd9b15ab24f549d1a1c6ae4ee7
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/interpr3.cxx9
1 files changed, 8 insertions, 1 deletions
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
{