BASIC + Base : The first row of a 2D array is lost

From the code in attached ods file.
Can you please help describe why the first row of a 2D array is lost.

LostFirstRowOfArray.ods

firebird0011.odb

Edited: Additional sample file

LostFirstRowOfArray2.ods

Can’t follow the procedure right now (my insight in StarBasic scope, call conventions and such is a bit rusty, to say the least), but a few potential sources of error spring to mind:

  • Is gGrid initialized (dimensioned) before the first pass?
  • Could it be conflicting names for local and global variables?

Dear @keme,

I have edited the question by only attaching another sample initializing each element of the array in simple way.

The following does not produce a message.

Sub SayHi
    If False Then Dim a
    MsgBox "hello"
End Sub

It looks to me like a bug in the Basic parser, because commands other than Dim and ReDim do not behave like this. Consider filing a bug report. If you do, add a comment here with a link to the bug number.

To fix the problem, close out the If statement fully.

Sub SayHi
    If False Then
        Dim a
    End If
    MsgBox "hello"
End Sub

In the future, please simplify your code as much as possible before posting. See guidelines for asking.

Dear @jimk,

Noted with great thanks.

Bug number: TDF133811