Euphoria
Ticket #107:
remove() crashes
-
Reported by
DerekParnell
Oct 23, 2009
When the start parameter is an undefined symbol and the stop parameter is omitted, calling eu:remove() will crash the interpreter.
? eu:remove("abc", notdefined) -- crashes
? eu:remove("abc", notdefined, notdefined) -- correct error message
Details
1. Comment by DerekParnell
Oct 23, 2009
Actually, it also fails with forward references.
? remove("abc", known) -- crashes
integer known = 2
2. Comment by jimcbrown
Oct 23, 2009
Running with int.ex or eu.ex reveals that we crash in parser.e line 1143 in Factor() because tok[T_SYM] is -1.
3. Comment by jimcbrown
Oct 23, 2009
While changing the line from:
if SymTab[sym][S_SCOPE] = SC_UNDEFINED then
to:
if sym < 0 or SymTab[sym][S_SCOPE] = SC_UNDEFINED then
gets rid of the crash, it still can't resolve the variable's forward reference.
4. Comment by jimcbrown
Oct 23, 2009
The forward reference failing seems to be by design?
Line 289 of fwdref.e, patch_forward_variable(), explicitly refuses to patch the forward reference for a variable if the symbol is declared in the same file and the forward reference occurs in the top level subroutine.