[Libreoffice-bugs] [Bug 123003] New: nested for-next loops: outer increment is wrong after leaving inner loop with "exit for"

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Sun Jan 27 21:31:36 UTC 2019


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

            Bug ID: 123003
           Summary: nested for-next loops: outer increment is wrong after
                    leaving inner loop with "exit for"
           Product: LibreOffice
           Version: 5.1.6.2 release
          Hardware: x86-64 (AMD64)
                OS: Linux (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: uwe.schmiedecke at gmx.de

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:

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20190127/3b6bd5c4/attachment.html>


More information about the Libreoffice-bugs mailing list