-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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] Top-level code isn't enforcing ownership and mutability #15
Comments
Thanks for the bug report! This seems specifically like a notebook environment bug, as it is occurring in top-level code (trying to do the same inside a function definition will cause a compilation error). @River707 I guess we need to track liveliness? |
Yep, this is workbook toplevel code specific, thanks for reporting it! |
Doing some triaging here, with Mojo 2024.1.0. I updated the example to reproduce the bug to the latest syntax: struct Foo:
var x: String
fn __init__(inout self, owned x: String):
self.x = x
fn __moveinit__(inout self, owned existing: Self):
self.x = existing.x
fn bar(owned foo: Foo) -> Int:
return 2
var foo = Foo(String("test"))
print(bar(foo^))
print(bar(foo^)) We now get this output:
So we're getting errors in the output, but the notebook cell is still considered successful and the code is still executed. That's a different bug, but still a bug. |
Bug Description
The program below crashes with a double-free error.
Steps to Reproduce
Run the following program in a notebook:
Context
Click to expand
11:freezer:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod58ead308_6b5e_4f48_a483_33eff7b8c09b.slice/cri-containerd-bf25cf0ee968cddde56ce666988b8ec79651ef4adadc6ffc15ae99baf64d98d8.scope 10:pids:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod58ead308_6b5e_4f48_a483_33eff7b8c09b.slice/cri-containerd-bf25cf0ee968cddde56ce666988b8ec79651ef4adadc6ffc15ae99baf64d98d8.scope 9:hugetlb:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod58ead308_6b5e_4f48_a483_33eff7b8c09b.slice/cri-containerd-bf25cf0ee968cddde56ce666988b8ec79651ef4adadc6ffc15ae99baf64d98d8.scope 8:net_cls,net_prio:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod58ead308_6b5e_4f48_a483_33eff7b8c09b.slice/cri-containerd-bf25cf0ee968cddde56ce666988b8ec79651ef4adadc6ffc15ae99baf64d98d8.scope 7:blkio:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod58ead308_6b5e_4f48_a483_33eff7b8c09b.slice/cri-containerd-bf25cf0ee968cddde56ce666988b8ec79651ef4adadc6ffc15ae99baf64d98d8.scope 6:cpu,cpuacct:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod58ead308_6b5e_4f48_a483_33eff7b8c09b.slice/cri-containerd-bf25cf0ee968cddde56ce666988b8ec79651ef4adadc6ffc15ae99baf64d98d8.scope 5:cpuset:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod58ead308_6b5e_4f48_a483_33eff7b8c09b.slice/cri-containerd-bf25cf0ee968cddde56ce666988b8ec79651ef4adadc6ffc15ae99baf64d98d8.scope 4:devices:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod58ead308_6b5e_4f48_a483_33eff7b8c09b.slice/cri-containerd-bf25cf0ee968cddde56ce666988b8ec79651ef4adadc6ffc15ae99baf64d98d8.scope 3:perf_event:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod58ead308_6b5e_4f48_a483_33eff7b8c09b.slice/cri-containerd-bf25cf0ee968cddde56ce666988b8ec79651ef4adadc6ffc15ae99baf64d98d8.scope 2:memory:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod58ead308_6b5e_4f48_a483_33eff7b8c09b.slice/cri-containerd-bf25cf0ee968cddde56ce666988b8ec79651ef4adadc6ffc15ae99baf64d98d8.scope 1:name=systemd:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod58ead308_6b5e_4f48_a483_33eff7b8c09b.slice/cri-containerd-bf25cf0ee968cddde56ce666988b8ec79651ef4adadc6ffc15ae99baf64d98d8.scope 0::/The text was updated successfully, but these errors were encountered: