The compiler failed to compile the code and crashed with segmentation fault.
Steps to reproduce
Include relevant code snippet or link to code that did not work as expected.
If applicable, add screenshots to help explain the problem.
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.
The code is as below:
fn main():
var s = String("Hello, World!")
var b_slice = s.as_bytes_slice()
_ = b_slice
And the compiler crashed with the backtrace below:
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: mojo main.mojo
#0 0x000000010458a198 llvm_strlcpy (/Users/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x1000be198)
#1 0x0000000104588484 llvm_strlcpy (/Users/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x1000bc484)
#2 0x000000010458a838 llvm_strlcpy (/Users/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x1000be838)
#3 0x000000018a9fb584 (/usr/lib/system/libsystem_platform.dylib+0x180477584)
#4 0x00000001056a3b40 __MIG_check__Request__mach_notify_dead_name_t (/Users/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x1011d7b40)
#5 0x00000001056a33b8 __MIG_check__Request__mach_notify_dead_name_t (/Users/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x1011d73b8)
#6 0x000000010569d554 __MIG_check__Request__mach_notify_dead_name_t (/Users/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x1011d1554)
#7 0x0000000105693cdc __MIG_check__Request__mach_notify_dead_name_t (/Users/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x1011c7cdc)
#8 0x0000000105b05994 mbedtls_version_get_number (/Users/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x101639994)
#9 0x0000000105b063cc mbedtls_version_get_number (/Users/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x10163a3cc)
#10 0x0000000105b090a8 mbedtls_version_get_number (/Users/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x10163d0a8)
#11 0x0000000104e179bc __MIG_check__Request__mach_notify_dead_name_t (/Users/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x10094b9bc)
#12 0x000000010495a508 __jit_debug_register_code (/Users/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x10048e508)
#13 0x0000000104e17518 __MIG_check__Request__mach_notify_dead_name_t (/Users/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x10094b518)
#14 0x0000000104e17048 __MIG_check__Request__mach_notify_dead_name_t (/Users/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x10094b048)
#15 0x0000000105bf9730 mbedtls_version_get_number (/Users/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x10172d730)
#16 0x0000000105bf8204 mbedtls_version_get_number (/Users/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x10172c204)
#17 0x000000010492158c __jit_debug_register_code (/Users/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x10045558c)
#18 0x00000001044e9f64 _mh_execute_header (/Users/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x10001df64)
#19 0x00000001044d316c _mh_execute_header (/Users/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x10000716c)
#20 0x000000018a6420e0
mojo crashed!
Please file a bug report.
[27792:18069029:20240527,105333.758524:WARNING in_range_cast.h:38] value -634136515 out of range
[27792:18069029:20240527,105333.855050:WARNING crash_report_exception_handler.cc:257] UniversalExceptionRaise: (os/kern) failure (5)
[1] 27790 segmentation fault mojo main.mojo
Also tried the snippet on Ubuntu 23.10 VM with OrbStack, the backtrace is as below:
Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes.
#0 0x0000aaaae5f57c7c (/home/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x1247c7c)
#1 0x0000aaaae5f55d18 (/home/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x1245d18)
#2 0x0000aaaae5f58380 (/home/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x1248380)
#3 0x0000ffff91559860 (linux-vdso.so.1+0x860)
#4 0x0000aaaae6400a8c (/home/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x16f0a8c)
#5 0x0000aaaae707e18c (/home/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x236e18c)
#6 0x0000aaaae707d6d0 (/home/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x236d6d0)
#7 0x0000aaaae7077894 (/home/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x2367894)
#8 0x0000aaaae706e558 (/home/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x235e558)
#9 0x0000aaaae745ac84 (/home/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x274ac84)
#10 0x0000aaaae745e400 (/home/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x274e400)
#11 0x0000aaaae67e664c (/home/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x1ad664c)
#12 0x0000aaaae630ff24 (/home/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x15fff24)
#13 0x0000aaaae67e6254 (/home/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x1ad6254)
#14 0x0000aaaae67e5e64 (/home/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x1ad5e64)
#15 0x0000aaaae752982c (/home/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x281982c)
#16 0x0000aaaae7529714 (/home/juni/.modular/pkg/packages.modular.com_nightly_mojo/bin/mojo+0x2819714)
#17 0x0000ffff910db1cc (/lib/aarch64-linux-gnu/libstdc++.so.6+0xdb1cc)
#18 0x0000ffff90ec37d0 (/lib/aarch64-linux-gnu/libc.so.6+0x837d0)
#19 0x0000ffff90f2f5cc (/lib/aarch64-linux-gnu/libc.so.6+0xef5cc)
mojo crashed!
Please file a bug report.
Segmentation fault
However, the two snippets below compiles:
fn main():
var s = String("Hello, World!")
var b_slice = s.as_bytes_slice()
_ = b_slice^
fn main():
var s = String("Hello, World!")
var b_slice = s.as_bytes_slice()
_ = b_slice
var b = b_slice[0]
_ = b
System information
- What OS did you do install Mojo on ?
macOS Sonoma 14.5 on a MacBook Pro M2 Max (Silicon)
Also tried on Ubuntu 23.10 arm64 (with OrbStack)
- Provide version information for Mojo by pasting the output of `mojo -v`
mojo 2024.5.2605 (9c328b12)
- Provide Modular CLI version by pasting the output of `modular -v`
modular 0.8.0 (39a426b5)
modular 0.7.4 (df7a9e8b) on Ubuntu 23.10 VM
Bug description
The compiler failed to compile the code and crashed with segmentation fault.
Steps to reproduce
The code is as below:
And the compiler crashed with the backtrace below:
Also tried the snippet on Ubuntu 23.10 VM with OrbStack, the backtrace is as below:
However, the two snippets below compiles:
System information