Bug 85431 - Matrix computation made by a libreoffice-basic function returning an array generates erratic errors 522
Summary: Matrix computation made by a libreoffice-basic function returning an array ge...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.2.6.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, regression
: 86487 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-10-25 09:48 UTC by Olivier DESCOUT
Modified: 2015-12-15 11:03 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
A calc sheet reproducing the matrix computation issue (82.75 KB, application/vnd.oasis.opendocument.spreadsheet)
2014-10-25 09:48 UTC, Olivier DESCOUT
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier DESCOUT 2014-10-25 09:48:30 UTC
Created attachment 108388 [details]
A calc sheet reproducing the matrix computation issue

Problem description: 
When recomputing matrix values computed by a libreoffice-basic function, which returns an array, CALC shows erratic errors 522, even though there are no circular references in the spreadsheet and the called BASIC function works perfectly fine under the debugger.

How to reproduce the issue:
- Open the attached Calc document. This document contains zero macro and 1 BASIC function (named "LOESS1") implementing a "Local regression fitting" (a.k.a. LOESS) algorithm (which has been successfully tested elsewhere). This function returns an array of Double and is called in the formula of a cell matrix (located in column C)
- Say "yes" to the "activate macros" question. The document gets open with no error in column C.
- Type a different number value in B3 (e.g. "76.8"). The column C gets recomputed, ending up with cells containing "Err:522".

Note that if you save the Calc document with that cell change, then close it and reopen it, the column C gets recomputed with no "Err:522"... until you change again a cell from column B.

Expected result:
No cell of the matrix should contain "Err:522" as there are no circular reference in the recomputed cell formulas and the called function does not generate any computation error.
Comment 1 raal 2014-10-26 19:14:11 UTC
I can confirm with Version: 4.4.0.0.alpha1+
Build ID: 04ea7b24ec1b5a027efa0b850f2bc3ac7116c52e
TinderBox: Linux-rpm_deb-x86_64@46-TDF, Branch:master, Time: 2014-10-25_08:38:01

CTRL+SHIFT+F9 (hard recalc) and calculation is correct, no Err:522
Comment 2 raal 2014-10-26 19:18:15 UTC
The same bug in LO 4.2.6, no problem in LO 3.5 -> regression
Comment 3 raal 2014-11-04 18:57:37 UTC
git bisect log
# bad: [423a84c4f7068853974887d98442bc2a2d0cc91b] source-hash-c15927f20d4727c3b8de68497b6949e72f9e6e9e
# good: [65fd30f5cb4cdd37995a33420ed8273c0a29bf00] source-hash-d6cde02dbce8c28c6af836e2dc1120f8a6ef9932
git bisect start 'latest' 'oldest'
# bad: [e02439a3d6297a1f5334fa558ddec5ef4212c574] source-hash-6b8393474974d2af7a2cb3c47b3d5c081b550bdb
git bisect bad e02439a3d6297a1f5334fa558ddec5ef4212c574
# good: [8f4aeaad2f65d656328a451154142bb82efa4327] source-hash-1885266f274575327cdeee9852945a3e91f32f15
git bisect good 8f4aeaad2f65d656328a451154142bb82efa4327
# bad: [9995fae0d8a24ce31bcb5e9cd0459b69cfbf7a02] source-hash-8600bc24bbc9029e92bea6102bff2921bc10b33e
git bisect bad 9995fae0d8a24ce31bcb5e9cd0459b69cfbf7a02
# good: [51b63dca7427db64929ae1885d7cf1cc7eb0ba28] source-hash-806d18ae7b8c241fe90e49d3d370306769c50a10
git bisect good 51b63dca7427db64929ae1885d7cf1cc7eb0ba28
# bad: [d65a58c31c8da044ef66ae4517fa2fe74cec0019] source-hash-2e053cf5ea4d93a2e1845e795a9c7fe1e08c84af
git bisect bad d65a58c31c8da044ef66ae4517fa2fe74cec0019
# bad: [79e02001f27d33b3b478324ab6fba5683413b4d9] source-hash-b6c016da23d309b4ac7d154bc33a22397974ed73
git bisect bad 79e02001f27d33b3b478324ab6fba5683413b4d9
# bad: [183a576d94de9a9439d580c8b81f335ab57cdbdc] source-hash-a599f5b4b51848e3b397d471c9d12b373caadcef
git bisect bad 183a576d94de9a9439d580c8b81f335ab57cdbdc
# good: [fae90325861bbddd2af90937d29d91637c96661a] source-hash-4316e643ef345b0f673b4a03a80a4b7cb3185588
git bisect good fae90325861bbddd2af90937d29d91637c96661a
# bad: [e5973caebe5b9637f93a4da008d76b33b9d5ff6a] source-hash-683758efb22d08a4cf211a6d985148f513da2a90
git bisect bad e5973caebe5b9637f93a4da008d76b33b9d5ff6a
# bad: [ba6eb41acb8df58f3009920f8ab8b32a3e1b764e] source-hash-ae4e4a11d4300f7448cb6bd170fcb034542caddc
git bisect bad ba6eb41acb8df58f3009920f8ab8b32a3e1b764e
# first bad commit: [ba6eb41acb8df58f3009920f8ab8b32a3e1b764e] source-hash-ae4e4a11d4300f7448cb6bd170fcb034542caddc


http://cgit.freedesktop.org/libreoffice/core/log/?qt=range&q=4316e643ef345b0f673b4a03a80a4b7cb3185588..ae4e4a11d4300f7448cb6bd170fcb034542caddc
Comment 4 raal 2014-11-20 13:53:43 UTC
*** Bug 86487 has been marked as a duplicate of this bug. ***
Comment 5 madvic 2014-11-20 13:59:00 UTC
Does anyone have a workaround solution in basic macro ?
Thanks
Comment 6 Matthew Francis 2014-12-26 09:35:13 UTC
I get a different bibisect range for this using the following exact reproduction instructions (in 43all). If it gets past both steps 3 and 4 without showing errors it's a good build.

1. Load the attached document
2. Ctrl-Shift-F9 to force recalculation
3. Set B3 to 75.9
4. Set B3 to 75.8

I also note that this seems to work correctly in 4.5 master, so I will follow up with another bibisect to find the fix and check which branches it's made it onto

 33fcd09137f9589d4f5f619e1b64347aa0beaef5 is the first bad commit
commit 33fcd09137f9589d4f5f619e1b64347aa0beaef5
Author: Bjoern Michaelsen <bjoern.michaelsen@canonical.com>
Date:   Mon Dec 10 01:37:20 2012 +0000

    source-hash-36170cd0dbc3409270cf3cf998805a790ee6228f
    
    commit 36170cd0dbc3409270cf3cf998805a790ee6228f
    Author:     Matúš Kukan <matus.kukan@gmail.com>
    AuthorDate: Fri Jul 13 20:42:16 2012 +0200
    Commit:     Matúš Kukan <matus.kukan@gmail.com>
    CommitDate: Tue Jul 17 16:40:24 2012 +0200
    
        tubes: start collaboration from the File->Collaborate menu as the only way
    
        This also kills LIBO_TUBES variable.
        Listen button is used for registering client handlers (was LIBO_TUBES=slave).
        It may not be possible (if the name is already in use by another process).
    
        Change-Id: I04e0eb8721fa8e74c6cff585c79124b18046aad4

# bad: [423a84c4f7068853974887d98442bc2a2d0cc91b] source-hash-c15927f20d4727c3b8de68497b6949e72f9e6e9e
# good: [65fd30f5cb4cdd37995a33420ed8273c0a29bf00] source-hash-d6cde02dbce8c28c6af836e2dc1120f8a6ef9932
git bisect start 'latest' 'oldest'
# bad: [e02439a3d6297a1f5334fa558ddec5ef4212c574] source-hash-6b8393474974d2af7a2cb3c47b3d5c081b550bdb
git bisect bad e02439a3d6297a1f5334fa558ddec5ef4212c574
# bad: [8f4aeaad2f65d656328a451154142bb82efa4327] source-hash-1885266f274575327cdeee9852945a3e91f32f15
git bisect bad 8f4aeaad2f65d656328a451154142bb82efa4327
# good: [369369915d3582924b3d01c9b01167268ed38f3b] source-hash-45295f3cdceb4c289553791071b5d7f4962d2ec4
git bisect good 369369915d3582924b3d01c9b01167268ed38f3b
# good: [6fce03a944bf50e90cd31e2d559fe8705ccc993e] source-hash-47e4a33a6405eb1b5186027f55bd9cb99b0c1fe7
git bisect good 6fce03a944bf50e90cd31e2d559fe8705ccc993e
# good: [da317333e5675622f55c9dda17396c659af65320] source-hash-15af925c254f27046427de70a59011e2ac3d6bdb
git bisect good da317333e5675622f55c9dda17396c659af65320
# bad: [18518588d8414f446ece5591944766f5082ebef5] source-hash-82c25249e624cb54ca6d3293d1c3d0d8ebc208e0
git bisect bad 18518588d8414f446ece5591944766f5082ebef5
# bad: [89740762f0af849e492932bd71e59149cdcd5a00] source-hash-06f20d73da21342046a480a6b22af69901351328
git bisect bad 89740762f0af849e492932bd71e59149cdcd5a00
# good: [66d8f76eaad7a1835bf0a828fb396b58b8f9dbaa] source-hash-21dd191b9fd5a75f7633ea27f745a347adb42ae3
git bisect good 66d8f76eaad7a1835bf0a828fb396b58b8f9dbaa
# bad: [ce3917fd9ea98ae2089cf4dca9cc742c10935e7f] source-hash-b0f170d7df9cff12535d2ecfd146b32b745a8ef8
git bisect bad ce3917fd9ea98ae2089cf4dca9cc742c10935e7f
# bad: [33fcd09137f9589d4f5f619e1b64347aa0beaef5] source-hash-36170cd0dbc3409270cf3cf998805a790ee6228f
git bisect bad 33fcd09137f9589d4f5f619e1b64347aa0beaef5
# first bad commit: [33fcd09137f9589d4f5f619e1b64347aa0beaef5] source-hash-36170cd0dbc3409270cf3cf998805a790ee6228f
Comment 8 Robinson Tryon (qubit) 2015-12-15 11:03:23 UTC
Migrating Whiteboard tags to Keywords: (bibisected)
[NinjaEdit]