Skip to content

@:nativeGen interface use leads to crash #1380

Description

@tobil4sk

When investigating HaxeFoundation/haxe#10427, I discovered that this program using native interfaces crashes:

@:nativeGen
interface IFirst {
        public function doFirst():Void;
}

@:nativeGen
interface ISecond {
        public function doSecond():Void;
}

class Main implements IFirst implements ISecond {
        public var data:Array<Int> = [1, 2, 3];

        public function new() {}

        public function doFirst() {
                trace(data);
        }

        public function doSecond() {
                trace(data);
        }

        static function main() {
                final obj = new Main();

                final interfaceRef:ISecond = obj;

                cpp.vm.Gc.run(true);

                interfaceRef.doSecond();
        }
}

Compiled on linux with:

haxe -m Main --cpp bin

This crashes while trying to join the Array because the ->length field has become garbage.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions