I ran across this problem and thought maybe someone can shed some light as to what i am doing wrong. I was able to boil down the code to one that shows the issue. To see the error happen just single step while in the debugger. I am using PowerBasic for Windows 10.03.
#COMPILE EXE #DIM ALL FUNCTION PBMAIN () AS LONG LOCAL i as LONG 'This Works DIM b(0) AS LONG b(0) = FIX(RND * 100) REDIM b(1) FOR i = 0 to 1 b(i) = FIX(RND * 100) NEXT i 'This FAILS DIM a AS iTestObject LET a = CLASS "cTestObject" a.DoSomething END FUNCTION CLASS cTestObject INSTANCE TestData() AS LONG 'Create CLASS METHOD InitData REDIM TestData(1) AS LONG END METHOD CLASS METHOD CREATE() 'This one works DIM TestData(0) END METHOD CLASS METHOD Destroy() ERASE TestData() END METHOD INTERFACE iTestObject INHERIT IUNKNOWN METHOD DoSomething() LOCAL i AS LONG 'Does not REDIM the TestData ME.InitData FOR i = 0 TO 1 '"Subscript/Pointer out of range" when i = 1 TestData(i) = FIX(RND * 100) NEXT i END METHOD END INTERFACE END CLASS