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
This is a strange one. I get a segmentation fault when trying to print the result of indexing a tensor without providing an index. However, this segfault is dependent on some other stuff in the code being present. For more details see the minimal example.
Steps to reproduce
Include relevant code snippet or link to code that did not work as expected.
I've come to the following minimal example of the issue:
Additional requirements:
a file named 'empty_file.txt' located at the same level as the mojo script that can just be empty
Strangely, the segfault seems to be dependent on:
The reading of the file (even though these contents are not used afterwards)
The for-loops being used (instead of just directly setting the single element of the tensor to False without iterating)
The for-loops using range(matrix.shape()[0] instead of just range(1)
The printing of matrix[]. Not sure what this is supposed to return normally, but normally this does not segfault and prints True. Also, printing matrix[0] does not segfault.
The element type of the tensor being either bool or int8, any other type seems to work fine
from pathlib import Path
from tensor import Tensor, TensorSpec, TensorShape
from utils.index import Index
fn main():
var p = Path("empty_file.txt")
var text: String
try:
text = p.read_text()
except Exception:
print("error")
return
var spec = TensorSpec(DType.bool, 1, 1)
var matrix = Tensor[DType.bool](spec)
for i in range(matrix.shape()[0]):
for j in range(matrix.shape()[1]):
matrix[Index[Int](i, j)] = False
print(matrix[])
If applicable, add screenshots to help explain the problem.
Not applicable.
If using the Playground, name the pre-existing notebook that failed and the steps that led to failure.
Not applicable.
Include anything else that might help us debug the issue.
I get the following stack dump:
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 crash.mojo
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 0x0000573f6d5c1407
1 mojo 0x0000573f6d5bf25e
2 mojo 0x0000573f6d5c1a9f
3 libc.so.6 0x00007a45fbc42520
4 libc.so.6 0x00007a4588001fcd
mojo crashed!
Please file a bug report.
[1] 44861 segmentation fault (core dumped) mojo crash.mojo
System information
- What OS did you do install Mojo on ?
Linux 6.5.0-28-generic #29~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr 4 14:39:20 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
- Provide version information for Mojo by pasting the output of `mojo -v`
mojo 24.3.0 (9882e19d)
- Provide Modular CLI version by pasting the output of `modular -v`
modular 0.7.4 (df7a9e8b)
The text was updated successfully, but these errors were encountered:
from tensor import Tensor, TensorSpec, TensorShape
from utils.index import Index
fn main():
var spec = TensorSpec(DType.bool, 1, 1)
var matrix = Tensor[DType.bool](spec)
for i in range(matrix.shape()[0]):
for j in range(matrix.shape()[1]):
matrix[Index[Int](i, j)] = False
print(matrix[])
Bug description
This is a strange one. I get a segmentation fault when trying to print the result of indexing a tensor without providing an index. However, this segfault is dependent on some other stuff in the code being present. For more details see the minimal example.
Steps to reproduce
Include relevant code snippet or link to code that did not work as expected.
I've come to the following minimal example of the issue:
Additional requirements:
Strangely, the segfault seems to be dependent on:
range(matrix.shape()[0]
instead of justrange(1)
matrix[]
. Not sure what this is supposed to return normally, but normally this does not segfault and printsTrue
. Also, printingmatrix[0]
does not segfault.bool
orint8
, any other type seems to work fineIf applicable, add screenshots to help explain the problem.
Not applicable.
If using the Playground, name the pre-existing notebook that failed and the steps that led to failure.
Not applicable.
Include anything else that might help us debug the issue.
I get the following stack dump:
System information
The text was updated successfully, but these errors were encountered: