ID:2772554
 
BYOND Version:514
Operating System:Windows 10 Pro 64-bit
Web Browser:Chrome 98.0.4758.102
Applies to:Dream Maker
Status: Open

Issue hasn't been assigned a status value.
Descriptive Problem Summary:

Code Snippet (if applicable) to Reproduce Problem:
/proc/test(list/L1)
var/list/L2 = list(4, 5, 6)
for (L1[L1 == L1] in L2)
. = 1
return

/world/New()
test(list(1, 2, 3))


Expected Results:
Shouldn't infinite loop.

Actual Results:
Infinite loop.

The code gen expects some flag set by the "IterNext" (0x53) instruction to specify whether the end of the list has been reached or not, but that flag is clobbered by the "Teq" (0x37) instruction which is generated for the `L1 == L1` expression.

  ...
  0011: 00000033 0000FFDA 00000000  GetVar local(0)
  0014: 00000052 00000005 00000000  IterLoad 5 ()
LAB_0017:
  0017: 00000053                    IterNext            ; Sets flags to 1 when the iterator wasn't finished, other 0
  0018: 00000033 0000FFD9 00000000  GetVar arg(0)
  001B: 00000033 0000FFD9 00000000  GetVar arg(0)
  001E: 00000033 0000FFD9 00000000  GetVar arg(0)
  0021: 00000037                    Teq                 ; Sets flags to 1 when the equality test passes (uh-oh)
  0022: 00000051                    Pop
  0023: 00000036                    GetFlag
  0024: 0000007C                    ListSet
  0025: 00000011 0000002F           Jz LAB_002F         ; Jumps to end of loop is flags are 0
  0027: 00000085 00000004           DbgLine 4
  0029: 00000050 00000001           PushInt 1
  002B: 00000034 0000FFD0           SetVar dot
  002D: 000000F8 00000017           JmpLoop LAB_0017
LAB_002F:
  002F: 00000085 00000005           DbgLine 5
  ...


Does the problem occur:
Every time on 514.1581 and 514.1578.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked?
I haven't seen a version this works on. Maybe a fairly old one.

Very interesting test case. I'll take a look. This is kind of low-priority to fix obviously because of the fact that it's a situation that should never happen in real code, but I definitely want it to work.