-
- Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Closed
Copy link
Labels
Description
This regression was introduced in the recent reset PR (system.reset is no longer magic (#12937)) (the 2nd regression i found for this PR although this one is more serious).
The root cause is probably not #12937 per se, but what may be a bug in VM regarding var parameters / moves.
Example
type Atom* = object bar: int proc main() = var s: seq[Atom] var atom: Atom for i in 0..<2: atom.bar = 5 s.add atom atom.reset # BUG # atom = default(type(atom)) # works echo s static: main() main()Current Output
nim c -r -f --warnings:off t0855.nim
@[(bar: 5)] @[(bar: 5), (bar: 0)] # BUG HERE Hint: operation successful (52766 lines compiled; 0.386 sec total; 58.273MiB peakmem; Debug Build) [SuccessX] @[(bar: 5)] @[(bar: 5), (bar: 5)] Expected Output
@[(bar: 5)] @[(bar: 5), (bar: 5)] Hint: operation successful (52766 lines compiled; 0.386 sec total; 58.273MiB peakmem; Debug Build) [SuccessX] @[(bar: 5)] @[(bar: 5), (bar: 5)] Possible Solution
- instead of reverting system.reset is no longer magic #12937, the underlying root cause in VM should be fixed as this easily pops up in other contexts
Additional Information
D20191230T155433
- regression introduced in system.reset is no longer magic #12937