| Summary: | Incorrect calculation of the boundaries of the For loop (Option VbaSupport 1) | ||
|---|---|---|---|
| Product: | LibreOffice | Reporter: | Vladimir Sokolinskiy <sokol> |
| Component: | BASIC | Assignee: | Not Assigned <libreoffice-bugs> |
| Status: | NEW --- | ||
| Severity: | normal | CC: | aron.budea, himajin100000, mikekaganski |
| Priority: | medium | ||
| Version: | 7.3.5.2 release | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: | https://bugs.documentfoundation.org/show_bug.cgi?id=150460 | ||
| Whiteboard: | |||
| Crash report or crash signature: | Regression By: | ||
| Bug Depends on: | |||
| Bug Blocks: | 108908 | ||
It should definitely be that way for VBA [1]. But why expect the same from non-compatibility mode? [1] https://stackoverflow.com/questions/27824936/for-start-to-end-loop-with-end-variable-changing-mid-loop I was born with this knowledge. :) OK, let's limit to a bug in case Option VbaSupport 1 Repro using Version: 7.4.0.3 (x64) / LibreOffice Community Build ID: f85e47c08ddd19c015c0114a68350214f7066f5a CPU threads: 12; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win Locale: ru-RU (ru_RU); UI: en-US Calc: CL Jumbo (with Option VBASupport 1, as mentioned in comment 3) http://msdn.microsoft.com/en-us/library/ee157012.aspx |
Run macro: Option Explicit Sub test Dim i As Long, j As Long, k As Long k=10 For i=1 To k k=1 j=i Next i Msgbox j End Sub Shown: 1 Must be: 10 `For loop` bounds must be evaluated once at the beginning.