Compiler exits with an unexpected Bad variable expression error when using ADDR on an array element (e.g.: ADDR(array&(1))).
Details
dEditM.opl:6:9: Bad variable expression
stack traceback:
[C]: in function 'error'
../src/compiler.lua:178: in upvalue 'synerror'
../src/compiler.lua:185: in upvalue 'synassert'
../src/compiler.lua:1632: in function 'compiler.handleFn_ADDR'
../src/compiler.lua:1406: in method 'emitExpression'
../src/compiler.lua:1974: in method 'parse'
../src/compiler.lua:1768: in function 'compiler.parseProc'
../src/compiler.lua:2765: in function 'compiler.docompile'
../src/compiler.lua:2787: in function 'compiler.compile'
[C]: in function 'xpcall'
../src/compile.lua:75: in function 'main'
[C]: in function 'xpcall'
../src/cmdline.lua:247: in function 'pcallMain'
../src/compile.lua:114: in main chunk
[C]: in ?
Using the following example from the OPL User Guide:
CONST KLenBuffer%=399
PROC dEditM:
LOCAL buffer&(101) REM 101=1+(399+3)/4 in integer arithmetic
LOCAL pLen&,pText&
LOCAL i%,c%
pLen&=ADDR(buffer&(1))
pText&=ADDR(buffer&(2))
WHILE 1
dINIT "Try dEditMulti"
dEDITMULTI pLen&,"Prompt",10,3,KLenBuffer%
dBUTTONS "Done",%d REM button needed to exit dialog
IF DIALOG=0 :BREAK :ENDIF
PRINT "Length:";buffer&(1)
PRINT "Text:"
i%=0
WHILE i%<buffer&(1)
c%=PEEKB(pText&+i%)
IF c%>=32
PRINT CHR$(c%)
ELSE
PRINT "."; REM just print a dot for special characters
ENDIF
i%=i%+1
ENDWH
ENDWH
ENDP
Description
Compiler exits with an unexpected
Bad variable expression
error when usingADDR
on an array element (e.g.:ADDR(array&(1))
).Details
Using the following example from the OPL User Guide: