Bug 123003 - nested for-next loops: outer increment is wrong after leaving inner loop with "exit for"
Summary: nested for-next loops: outer increment is wrong after leaving inner loop with...
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
5.1.6.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-27 21:31 UTC by Uwe Schmiedecke
Modified: 2019-09-02 09:37 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Uwe Schmiedecke 2019-01-27 21:31:36 UTC
Description:
Loop count error:
after the inner loop is left using "exit for" the stmt "next ii" below will increment the inner loop counter "jj" instead of "ii"!

function endOfSheet
for ii = 100 TO 16000
    if oSheet.getCellRangeByName("A" & ii).String = "" then
       ' 20 Zeilen rückwärts suchen:
       for jj = 1 to 101
         if oSheet.getCellRangeByName("A" & (ii-jj)).String <> "" then
            if jj > 20 then
               endOfSheet = ii-jj+1
               exit function
            end if
            exit for ' ***** THIS CAUSES THE ERROR!!! (see above)
         endif
       next jj
    end if
  next ii ' ****** HERE THE ERROR CAN BE OBSERVED USING DEBUGGER
end function

my OS version is Ubuntu 16.04.5 LTS
Libreoffice-Version: 5.1.6.2
Build-ID: 1:5.1.6~rc2-0ubuntu1~xenial4
CPU-Threads: 4; BS-Version: Linux 4.4; UI-Render: Standard; 

Steps to Reproduce:
1. test the above example using debugger
2.
3.

Actual Results:
the statement "next ii" increments jj instad of ii

Expected Results:
after the inner "exit for" the outer loop should increment ii and not jj


Reproducible: Always


User Profile Reset: No



Additional Info:
Comment 1 Mike Kaganski 2019-01-27 22:58:48 UTC
Please provide everything necessary to reproduce the error: the macro is incomplete (how oSheet is defined?); and it cannot be run on an empty worksheet, so please attach a sample data or describe how to prepare one.

Please reset to UNCONFIRMED when provided necessary info. Thanks!
Comment 2 QA Administrators 2019-07-30 03:18:30 UTC Comment hidden (obsolete)
Comment 3 QA Administrators 2019-09-02 09:37:27 UTC
Dear Uwe Schmiedecke,

Please read this message in its entirety before proceeding.

Your bug report is being closed as INSUFFICIENTDATA due to inactivity and
a lack of information which is needed in order to accurately
reproduce and confirm the problem. We encourage you to retest
your bug against the latest release. If the issue is still
present in the latest stable release, we need the following
information (please ignore any that you've already provided):

a) Provide details of your system including your operating
   system and the latest version of LibreOffice that you have
   confirmed the bug to be present

b) Provide easy to reproduce steps – the simpler the better

c) Provide any test case(s) which will help us confirm the problem

d) Provide screenshots of the problem if you think it might help

e) Read all comments and provide any requested information

Once all of this is done, please set the bug back to UNCONFIRMED
and we will attempt to reproduce the issue. Please do not:

a) respond via email 

b) update the version field in the bug or any of the other details
   on the top section of our bug tracker

Warm Regards,
QA Team

MassPing-NeedInfo-FollowUp