Euphoria Ticket #107: remove() crashes

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

Type: Bug Report Severity: Major Category: Interpreter
Assigned To: unknown Status: Fixed Reported Release: rev 2945
Fixed in SVN #: 2962 View VCS: 2962 Milestone:

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.

Search



Quick Links

User menu

Not signed in.

Misc Menu