Skip to content

VM crash when adding a double and an object with a toDouble method, in production mode #100

Closed
@DartBot

Description

@DartBot

This issue was originally filed by olov.lassu...@gmail.com


Reduced test-case (run in VM with type-checking disabled):
class C {
    toDouble() => 0;
}
main() {
    print(2.2 + new C());
}

This is what happens:
~/projects/dart/dart % dart --enable_asserts toDoubleBug.dart
./vm/object.h:2201: error: Handle check failed.
zsh: abort dart --enable_asserts toDoubleBug.dart

What should happen:
Not sure (not crash obviously). Checked mode complains (Failed type check: type C is not assignable to type num of other in bootstrap_impl at line 898, column 25.) but it's not clear to me how toDouble is supposed to be used or not currently.

Stack trace:

­0 0x91fb6332 in __kill ()

­1 0x91fb5932 in kill$UNIX2003 ()

­2 0x9b85ac0c in abort ()

­3 0x000d1df1 in dart::DynamicAssertionHelper::Fail (this=0xbfffeaa0, format=0x184348 "%s") at /Users/olov/projects/dart/dart/runtime/vm/assert.cc:39

­4 0x000be5f5 in dart::Double::CheckedHandle (raw_ptr=0x0) at object.h:2201

­5 0x000bcd2e in dart::DN_HelperDouble_add (arguments=0xbffff1a4) at /Users/olov/projects/dart/dart/runtime/lib/double.cc:26

­6 0x000bcf0b in dart::DN_Double_add (args=0xbffff1a4) at /Users/olov/projects/dart/dart/runtime/lib/double.cc:24

­7 0x00440162 in ?? ()

­8 0x006005fc in ?? ()

­9 0x0060042d in ?? ()

­10 0x006002c2 in ?? ()

­11 0x0060007d in ?? ()

­12 0x000f9dfd in dart::DartEntry::InvokeStatic (function=@0xbe4ae8, arguments=@0xbffff368, optional_arguments_names=@0xbe4af0) at /Users/olov/projects/dart/dart/runtime/vm/dart_entry.cc:83

­13 0x000ae507 in dart::InvokeStatic (function=@0xbe4ae8, args=@0xbffff368, result=0xbffff378) at /Users/olov/projects/dart/dart/runtime/vm/dart_api_impl.cc:844

­14 0x000b012f in Dart_InvokeStatic (library_in=0xbe0410, class_name_in=0xbe0418, function_name_in=0xbe0414, number_of_arguments=0, arguments=0x0) at /Users/olov/projects/dart/dart/runtime/vm/dart_api_impl.cc:958

­15 0x00002bfb in main (argc=2, argv=0xbffffac8) at /Users/olov/projects/dart/dart/runtime/bin/main.cc:224

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions