Created attachment 108304 [details] Nothing new here. Textfile with the code from the description. Trying to Redim a field inside a function with the function name fails with an "Reading Error. Property is read only"-error. Run this code, to see the error: Sub Main Dim FieldOfLongs() As Long Dim l As Long l = foo(FieldOfLongs) End Sub Function foo(FieldOfLongs() As Long) As Long Print "foo ist actually " & foo Dim Zero As Long Redim FieldOfLongs(Zero) As Long 'Redim works Redim FieldOfLongs(foo) As Long 'Redim fails with error End Function The expected behaviour is, that the function name should behave just like any other variable within the function. Problem arises on Lubuntu 14.04 with Version: 4.2.6.3 Build-ID: 420m0(Build:3) The error actually says "Lesefehler. Eigenschaft ist schreibgeschützt" in my Germann version of LO.
I confirm the error. Version: 4.4.0.0.alpha1+ Build ID: 0a82645c360158f9cc0fdabe2a52f1ff8f981bed TinderBox: Win-x86@39, Branch:master, Time: 2014-10-24_06:59:23
There seem to be more problems with using the function name as a variable inside the function. It can not be used as the loop variable in a For ... Next loop. Sub Main Print foob() Print fool() End Sub 'This surrogate works Function foob() As long foob = 1 LoopLable: Print foob foob = foob + 1 If foob < 4 Then Goto LoopLable End Function 'While the For ... Next doesn't Function fooc() As long For fooc = 1 To 3 Print fooc Next fooc End Function
** Please read this message in its entirety before responding ** To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present on a currently supported version of LibreOffice (5.0.4 or later) https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the version of LibreOffice and your operating system, and any changes you see in the bug behavior the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a short comment that includes your version of LibreOffice and Operating System Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) http://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to "inherited from OOo"; 4b. If the bug was not present in 3.3 - add "regression" to keyword Feel free to come ask questions or to say hello in our QA chat: http://webchat.freenode.net/?channels=libreoffice-qa Thank you for your help! -- The LibreOffice QA Team This NEW Message was generated on: 2015-12-20
** Please read this message in its entirety before responding ** To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present on a currently supported version of LibreOffice (5.1.6 or 5.2.3 https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the version of LibreOffice and your operating system, and any changes you see in the bug behavior If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a short comment that includes your version of LibreOffice and Operating System Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) http://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to "inherited from OOo"; 4b. If the bug was not present in 3.3 - add "regression" to keyword Feel free to come ask questions or to say hello in our QA chat: http://webchat.freenode.net/?channels=libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug-20170103
Still confirmed Arch Linux 64-bit Version: 6.4.0.0.alpha0+ Build ID: 37fc9f51a8de11d40632e8cda17ccf1fa4b1f503 CPU threads: 8; OS: Linux 5.2; UI render: default; VCL: gtk3; Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US Calc: threaded Built on 6 August 2019
Created attachment 153300 [details] Screenshot of the error
@Buovjaga 2019-08-11 11:31:03 UTC Thank you for reminding me. The error is still with me in the version supplied with Lubuntu 18.04 LTS, which is Version: 6.0.7.3, Build-ID: 1:6.0.7-0ubuntu0.18.04.8
(In reply to ge.huber from comment #2) > There seem to be more problems with using the function name as a variable > inside the function. It can not be used as the loop variable in a For ... > Next loop. Hopefully correct version, that is the one, which shows the bug clearly. Sub Main Print "foob is " & foob() 'works Print "fooc is " & fooc() 'fails End Sub 'This surrogate works Function foob() As long foob = 1 LoopLable: Print "foob is now " & foob foob = foob + 1 If foob < 4 Then Goto LoopLable End Function 'While the For ... Next doesn't Function fooc() As long For fooc = 1 To 3 'error occurs here Print "fooc is now " & fooc Next fooc End Function
Just a guess: As I pointed out in tdf#57308, SbMethod is silently added to refParams at index 0. This method basically has the flag SbxFlagBits::Read only, so we cannot write to this variable. https://opengrok.libreoffice.org/xref/core/basic/source/classes/sbxmod.cxx?r=889dc7bf#502 However, if the variable is used in a function(pMeth) with the same name as the variable, the variable will be given a SbxFlagBits::Write. https://opengrok.libreoffice.org/xref/core/basic/source/runtime/runtime.cxx?r=889dc7bf#1651 and the flag will be restored later in StepPUT. On the other hand if the variable is used in StepINITFOR,StepNext https://opengrok.libreoffice.org/xref/core/basic/source/comp/loops.cxx?r=ab9b67bb#238 https://opengrok.libreoffice.org/xref/core/basic/source/inc/opcodes.hxx?r=abe5a1a5#28 https://opengrok.libreoffice.org/xref/core/basic/source/runtime/runtime.cxx?r=889dc7bf#763 https://opengrok.libreoffice.org/xref/core/basic/source/runtime/runtime.cxx?r=889dc7bf#StepINITFOR https://opengrok.libreoffice.org/xref/core/basic/source/runtime/runtime.cxx?r=889dc7bf#2546 SbxFlagBits::Write is not set to this variable. I guess this is the cause.
Andreas Heinisch committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/48d46bcc903aedf0dd82746222c5333e3cd116a1 tdf#85371 - grant write access to the method used as a variable It will be available in 7.1.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Credits again to himajin100000@gmail.com and Mike Kaganski.
I verify the fix Arch Linux 64-bit Version: 7.1.0.0.alpha1+ Build ID: 1a4ae360d06ae300a8fd5482b3b3a86dc021750d CPU threads: 8; OS: Linux 5.9; UI render: default; VCL: kf5 Locale: fi-FI (fi_FI.UTF-8); UI: en-US Calc: threaded Built on 30 October 2020