You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to run the following example program with (intended) wrong ownership annotation of one of the parameter. It output the correct error message but followed by a crash. I then realized that I didn't have LLVM installed on my mac. After installing LLVM (and llvm-symbolizer) the crash went away. So it is possible that the crash is caused by the fact that llvm-symbolizer is not found.
Steps to reproduce
Include relevant code snippet or link to code that did not work as expected.
=================== The source code: ===================
# @value
struct MyPet:
var name: String
var age: Int
fn __init__(inout self, owned n: String, a: Int):
self.name = n^
self.age = a
print(self.name, ": ", self.age)
fn __copyinit__(inout self, rhs: MyPet):
self.name = rhs.name
self.age = rhs.age
fn __moveinit__(inout self, rhs: MyPet):
self.name = rhs.name^
self.age = rhs.age
fn __del__(owned self):
print("\tDestruct", self.name)
fn pets():
var a = MyPet("Loki", 4)
var b = MyPet("Sylvie", 2)
print(a.name)
# Zn: @value is a little confusing as it doe not mean immutable class.
# Zn: how to define a immutable struct in Mojo?
a.name = "fake"
# 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()
If applicable, add screenshots to help explain the problem.
================ The error message: ===================
(base) nings-mbp:del ningzhang$ '/Users/ningzhang/.modular/pkg/packages.modular.com_max/bin/mojo' '/Users/ningzhang/test/mojo_max/del/del.mojo'
/Users/ningzhang/test/mojo_max/del/del.mojo:15:33: error: existing value argument must be passed as owned
fn __moveinit__(inout self, rhs: MyPet):
^
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:
0. Program arguments: /Users/ningzhang/.modular/pkg/packages.modular.com_max/bin/mojo /Users/ningzhang/test/mojo_max/del/del.mojo
1. Crash resolving decl body at loc("/Users/ningzhang/test/mojo_max/del/del.mojo":2:8)
>> struct MyPet:
^.....
>> var name: String
>> var age: Int
>>
>> fn __init__(inout self, owned n: String, a: Int):
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 0x0000000102f00c04 llvm_strlcpy 51480
1 mojo 0x0000000102efeef0 llvm_strlcpy 44036
2 mojo 0x0000000102f012a4 llvm_strlcpy 53176
3 libsystem_platform.dylib 0x000000019d58f584 _sigtramp 56
4 mojo 0x0000000103244488 __jit_debug_register_code 709568
5 mojo 0x0000000103244bbc __jit_debug_register_code 711412
6 mojo 0x00000001031be52c __jit_debug_register_code 160868
7 mojo 0x00000001031cacb0 __jit_debug_register_code 211944
8 mojo 0x00000001031cb17c __jit_debug_register_code 213172
9 mojo 0x00000001031d4788 __jit_debug_register_code 251584
10 mojo 0x00000001031d49a8 __jit_debug_register_code 252128
11 mojo 0x0000000102e4e8c8
12 mojo 0x0000000102e606b0
13 mojo 0x0000000102e49940
14 dyld 0x000000019d1d60e0 start 2360
mojo crashed!
Please file a bug report.
[30546:4088829:20240712,155400.429252:WARNING crash_report_exception_handler.cc:257] UniversalExceptionRaise: (os/kern) failure (5)
Segmentation fault: 11
If using the Playground, name the pre-existing notebook that failed and the steps that led to failure.
Include anything else that might help us debug the issue.
llvm (and llvm-symbolizer) was not installed when the crash happened.
System information
- What OS did you do install Mojo on ?
macOSX
- Provide version information for Mojo by pasting the output of `mojo -v`
mojo 24.4.0 (59977802)
- Provide Modular CLI version by pasting the output of `modular -v`
modular 0.8.0 (39a426b5)
The text was updated successfully, but these errors were encountered:
Bug description
I tried to run the following example program with (intended) wrong ownership annotation of one of the parameter. It output the correct error message but followed by a crash. I then realized that I didn't have LLVM installed on my mac. After installing LLVM (and llvm-symbolizer) the crash went away. So it is possible that the crash is caused by the fact that llvm-symbolizer is not found.
Steps to reproduce
=================== The source code: ===================
================ The error message: ===================
llvm (and llvm-symbolizer) was not installed when the crash happened.
System information
The text was updated successfully, but these errors were encountered: