Bug 150491 - Infinite recursion in a VBA macro that works without errors in Excel
Summary: Infinite recursion in a VBA macro that works without errors in Excel
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
7.0 all versions
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Macro-VBA
  Show dependency treegraph
 
Reported: 2022-08-19 07:24 UTC by Mike Kaganski
Modified: 2022-08-19 09:47 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
An XLSM with a VBA macro showing infinite recursion in LibreOffice Basic (12.98 KB, application/vnd.ms-excel.sheet.macroEnabled.12)
2022-08-19 07:24 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2022-08-19 07:24:19 UTC
Created attachment 181876 [details]
An XLSM with a VBA macro showing infinite recursion in LibreOffice Basic

Running 'main' macro from the attachment produces this error:

> BASIC runtime error.
> '28'
> Not enough stack memory.

It runs OK in Excel, showing a message box with "1".

The macro code there is this:

Option VBASupport 1
Function NotRecursive()
  Set NotRecursive = New Collection
  NotRecursive.Add "Foo"
End Function

Sub main()
  Dim c
  Set c = NotRecursive
  MsgBox c.Count
End Sub

The infinite recursion happens on 'NotRecursive.Add "Foo"', where LibreOffice Basic tries to call the function again.

Possibly this should only be fixed in VBASupport mode.
Comment 1 Roman Kuznetsov 2022-08-19 07:37:09 UTC
Confirm in

Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: bfca51d9035000e518e4938ceb145cb92cc17b1f
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: ru-RU (ru_RU); UI: ru-RU
Calc: threaded
Comment 2 Xisco Faulí 2022-08-19 09:47:52 UTC
Also reproduced in

Version: 6.4.0.0.alpha1+
Build ID: 9bc848cf0d301aa57eabcffa101a1cf87bad6470
CPU threads: 8; OS: Linux 5.10; UI render: default; VCL: gtk3; 
Locale: es-ES (es_ES.UTF-8); UI-Language: en-US
Calc: threaded