https://bugs.documentfoundation.org/show_bug.cgi?id=152943

            Bug ID: 152943
           Summary: GetErrCode() doesn't work as expected on RISC-V due to
                    invalid floating-point operation in KahanSum
           Product: LibreOffice
           Version: 7.6.0.0 alpha0+ Master
          Hardware: Other
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: [email protected]
          Reporter: [email protected]

Description:
I ran ucalc_formula_test and testExternalRefFunctions() always failed with 503
error (538 expected) on RISC-V. I noticed that the error code was put in a NaN
floating-point variable (e.g Error 538 is 0x7ff800000000021a) wrapped in a
KahanSum class in interpr6.cxx:466~922. But these NaN values were added up in
kahan.hxx:add().

On x86, when NaN floating-point added, the significand bits are reserved but on
RISC-V they are cleared. Maybe it is just a coincidence that the test passes on
x86?

Perhaps the error value should be directly reserved in a double variable rather
than wrapped in a KahanSum class to avoid being operated?

Steps to Reproduce:
(On any arch)
In source code folder, run `make CppunitTest_sc_ucalc_formula CPPUNITTRACE="gdb
--args"`
Then in gdb, run
1. break ucalc_formula.cxx:7180 (FormulaError nErr = pFC->GetErrCode();)
2. run
3. break kahan.hxx:59 (double t = m_fSum + m_fMem;)
4. continue
Error code(0x7ff800000000021a) was reserved in m_fMem. m_fSum and m_fError are
calculated after add() func.

Actual Results:
In testExternalRefFunctions(), the result is 503 - invalid floating point
operation

Expected Results:
Error 538 - MatrixSizeError


Reproducible: Always


User Profile Reset: No

Additional Info:
Nothing.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to