Skip to content

GC Bug #2719

Closed
Closed
@HerrCai0907

Description

@HerrCai0907

Bug description

class T {
v: i32 = 0;
}

function f1(a: i32, t: T, b: i32): void {
  trace("f1", 1, t.v);
}

function f2(t: T): i32 {
  __collect();  // gc will recover the second argument T in f1
  let c = new T();
  c.v = 100;
  return 1;
}

export function _start(): void {
  f1(1, new T(), f2(new T()));
}

This code will output f1 100 instead of f1 0

Steps to reproduce

run those code

AssemblyScript version

0.25.2 - 0.27

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions