Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Assertion failed: (isa<To>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file Casting.h, line 566. #2408

Closed
yar999 opened this issue Apr 25, 2024 · 1 comment
Labels
bug Something isn't working mojo Issues that are related to mojo mojo-repo Tag all issues with this label

Comments

@yar999
Copy link

yar999 commented Apr 25, 2024

Bug description

@value
struct MyPet:
    var name: String
    var age: Int

    fn __del__(owned self):
        print("Destruct", self.name)


fn pets():
    var a = MyPet("Loki", 4)
    var b = MyPet("Sylvie", 2)
    print(a.name)
    # a.__del__() runs here for "Loki"

    a = MyPet("Charlie", 8)
    # a.__del__() runs immediately because "Charlie" is never used

    print(b.name)
    # b.__del__() runs here


fn main():
    pets()

mojo main.mojo runs and crashes

Assertion failed: (isa<To>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file Casting.h, line 566.
Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes.
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  mojo                     0x000000010435bc88 llvm_strlcpy + 54448
1  mojo                     0x0000000104359de8 llvm_strlcpy + 46608
2  mojo                     0x000000010435c328 llvm_strlcpy + 56144
3  libsystem_platform.dylib 0x000000019050b584 _sigtramp + 56
4  libsystem_pthread.dylib  0x00000001904dac20 pthread_kill + 288
5  libsystem_c.dylib        0x00000001903e7a20 abort + 180
6  libsystem_c.dylib        0x00000001903e6d10 err + 0
7  mojo                     0x0000000106e1f8e8 mbedtls_ssl_handshake_server_step + 33192060
8  mojo                     0x00000001055ebd90 mbedtls_ssl_handshake_server_step + 7814436
9  mojo                     0x00000001055eb880 mbedtls_ssl_handshake_server_step + 7813140
10 mojo                     0x00000001055ea780 mbedtls_ssl_handshake_server_step + 7808788
11 mojo                     0x00000001055e9460 mbedtls_ssl_handshake_server_step + 7803892
12 mojo                     0x00000001055e8da8 mbedtls_ssl_handshake_server_step + 7802172
13 mojo                     0x00000001055e1144 mbedtls_ssl_handshake_server_step + 7770328
14 mojo                     0x00000001069ff5b0 mbedtls_ssl_handshake_server_step + 28865860
15 mojo                     0x00000001069ffc08 mbedtls_ssl_handshake_server_step + 28867484
16 mojo                     0x0000000106a01cbc mbedtls_ssl_handshake_server_step + 28875856
17 mojo                     0x00000001056369d8 mbedtls_ssl_handshake_server_step + 8120684
18 mojo                     0x0000000104751c60 llvm_strlcpy + 4207752
19 mojo                     0x0000000105636020 mbedtls_ssl_handshake_server_step + 8118196
20 mojo                     0x0000000105635b60 mbedtls_ssl_handshake_server_step + 8116980
21 mojo                     0x0000000105db44b8 mbedtls_ssl_handshake_server_step + 15975500
22 mojo                     0x0000000105db4260 mbedtls_ssl_handshake_server_step + 15974900
23 mojo                     0x0000000105db42fc mbedtls_ssl_handshake_server_step + 15975056
24 libsystem_pthread.dylib  0x00000001904daf94 _pthread_start + 136
25 libsystem_pthread.dylib  0x00000001904d5d34 thread_start + 8
0x107cb9300 crashed!
Please file a bug report.
[44504:795347:20240425,234857.980957:WARNING crash_report_exception_handler.cc:257] UniversalExceptionRaise: (os/kern) failure (5)
zsh: abort      mojo main.mojo

Steps to reproduce

mojo main.mojo runs and crashes

System information

mojo 24.2.1 (2f0dcf11)
modular 0.7.2 (d0adc668
macOS M1 14.4.1 (23E224)
@yar999 yar999 added bug Something isn't working mojo Issues that are related to mojo labels Apr 25, 2024
@ematejska ematejska added the mojo-repo Tag all issues with this label label Apr 29, 2024
Copy link
Collaborator

This appears to be fixed.

@ematejska ematejska closed this as not planned Won't fix, can't repro, duplicate, stale May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mojo Issues that are related to mojo mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

2 participants