kitlang / kit

Kit: a magical, high performance programming language, designed for game development.
https://www.kitlang.org
Other
1.02k stars 29 forks source link

Segfault on Vector access after resize #87

Closed bendmorris closed 5 years ago

bendmorris commented 5 years ago
struct MyStruct {
    public var a: Int;
    public var b: Int;
}

function main() {
    var n: Int = 0x1000;
    var a: Array[MyStruct] = Array.new(n * 2);
    var v: Vector[Ptr[MyStruct]] = Vector.new(n);

    for i in 0 ... n * 2 {
        var x: Ptr[MyStruct] = a[i];
        v.push(x);
    }

    printf("%zx\n", v.length);
}