Open Ndot10 opened 1 year ago
Thank you for filing. Support for “top level code” at file scope is not available yet as indicated in the error message. Please see our roadmap document here: https://docs.modular.com/mojo/roadmap.html. Turning this into a top-level enhancement request.
I now realize that my bug description was rather unclear.
The *()
does not have to be in the top level for the crash to occur, it can occur anywhere in the file.
➜ ~ mojo run /file.mojo # Regular top level expression.
/file.mojo:1:1: error: TODO: expressions are not yet supported at the file scope level
print("Top level")
^
mojo: error: failed to parse the provided Mojo
➜ ~ mojo run /file.mojo # `*()` in the top level.
/file.mojo:1:1: error: TODO: expressions are not yet supported at the file scope level
*()
^
mojo: /__w/modular/modular/KGEN/lib/MojoParser/ExprNodes.cpp:2342: virtual M::KGEN::LIT::AnyValue M::KGEN::LIT::UnaryOpNode::emitIR(M::KGEN::LIT::ValueDest &, M::KGEN::LIT::ExprEmitter &) const: Assertion `specialFnInfo.kind != SpecialFunctionKind::kNormal && "Unary operators are implemented via special methods"' failed.
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 run /file.mojo
1. Crash resolving decl body at loc("/file.mojo":1:1)
>> *()
^..<
2. Crash parsing statement at loc("/file.mojo":1:1)
>> *()
^..<
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 0x0000559f2bfea797
1 mojo 0x0000559f2bfe836e
2 mojo 0x0000559f2bfeae6f
3 libc.so.6 0x00007f36d823c4b0
4 libc.so.6 0x00007f36d8290ffb pthread_kill + 283
5 libc.so.6 0x00007f36d823c406 gsignal + 22
6 libc.so.6 0x00007f36d822287c abort + 215
7 libc.so.6 0x00007f36d822279b
8 libc.so.6 0x00007f36d8233b86
9 mojo 0x0000559f2c423ef5
10 mojo 0x0000559f2c4098b9
11 mojo 0x0000559f2c43770b
12 mojo 0x0000559f2c432a94
13 mojo 0x0000559f2c432946
14 mojo 0x0000559f2c3eece3
15 mojo 0x0000559f2c3e4b3b
16 mojo 0x0000559f2c3bba6d
17 mojo 0x0000559f2c3c7656
18 mojo 0x0000559f2c3c7540
19 mojo 0x0000559f2d94d7ea
20 mojo 0x0000559f2d9545dc
21 mojo 0x0000559f2d952954
22 mojo 0x0000559f2c3bb5db
23 mojo 0x0000559f2c3b9026
24 mojo 0x0000559f2c3ba583
25 mojo 0x0000559f2c3b2f42
26 mojo 0x0000559f2c3aed26
27 mojo 0x0000559f2c3af6ab
28 mojo 0x0000559f2bfb4d3f
29 mojo 0x0000559f2bf9ff60
30 mojo 0x0000559f2bfb3c4d
31 mojo 0x0000559f2bf998fe
32 libc.so.6 0x00007f36d8223a90
33 libc.so.6 0x00007f36d8223b49 __libc_start_main + 137
34 mojo 0x0000559f2bf990fe
[1] 1 IOT instruction (core dumped) mojo run /file.mojo
➜ ~ mojo run /file.mojo # `*()` in a function body.
mojo: /__w/modular/modular/KGEN/lib/MojoParser/ExprNodes.cpp:2342: virtual M::KGEN::LIT::AnyValue M::KGEN::LIT::UnaryOpNode::emitIR(M::KGEN::LIT::ValueDest &, M::KGEN::LIT::ExprEmitter &) const: Assertion `specialFnInfo.kind != SpecialFunctionKind::kNormal && "Unary operators are implemented via special methods"' failed.
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 run /file.mojo
1. Crash resolving decl body at loc("/file.mojo":1:1)
>> def main():
^..........
>> *()
.......<
2. Crash parsing statement at loc("/file.mojo":2:5)
>> *()
^..<
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 0x000055c9ea645797
1 mojo 0x000055c9ea64336e
2 mojo 0x000055c9ea645e6f
3 libc.so.6 0x00007f1f5aa3c4b0
4 libc.so.6 0x00007f1f5aa90ffb pthread_kill + 283
5 libc.so.6 0x00007f1f5aa3c406 gsignal + 22
6 libc.so.6 0x00007f1f5aa2287c abort + 215
7 libc.so.6 0x00007f1f5aa2279b
8 libc.so.6 0x00007f1f5aa33b86
9 mojo 0x000055c9eaa7eef5
10 mojo 0x000055c9eaa648b9
11 mojo 0x000055c9eaa9270b
12 mojo 0x000055c9eaa8da94
13 mojo 0x000055c9eaa8d946
14 mojo 0x000055c9eaa47952
15 mojo 0x000055c9eaa3f96e
16 mojo 0x000055c9eaa3dea9
17 mojo 0x000055c9eaa09d3a
18 mojo 0x000055c9eaa0a6ab
19 mojo 0x000055c9ea60fd3f
20 mojo 0x000055c9ea5faf60
21 mojo 0x000055c9ea60ec4d
22 mojo 0x000055c9ea5f48fe
23 libc.so.6 0x00007f1f5aa23a90
24 libc.so.6 0x00007f1f5aa23b49 __libc_start_main + 137
25 mojo 0x000055c9ea5f40fe
[1] 3191403 IOT instruction (core dumped) mojo run /file.mojo
➜ ~ mojo run /file.mojo # `*()` in a variable asignment.
mojo: /__w/modular/modular/KGEN/lib/MojoParser/ExprNodes.cpp:2342: virtual M::KGEN::LIT::AnyValue M::KGEN::LIT::UnaryOpNode::emitIR(M::KGEN::LIT::ValueDest &, M::KGEN::LIT::ExprEmitter &) const: Assertion `specialFnInfo.kind != SpecialFunctionKind::kNormal && "Unary operators are implemented via special methods"' failed.
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 run /file.mojo
1. Crash resolving decl body at loc("/file.mojo":1:1)
>> def main():
^..........
>> var variable = *()
......................<
2. Crash parsing statement at loc("/file.mojo":2:5)
>> var variable = *()
^.................<
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 0x000055c2412a4797
1 mojo 0x000055c2412a236e
2 mojo 0x000055c2412a4e6f
3 libc.so.6 0x00007f4a1083c4b0
4 libc.so.6 0x00007f4a10890ffb pthread_kill + 283
5 libc.so.6 0x00007f4a1083c406 gsignal + 22
6 libc.so.6 0x00007f4a1082287c abort + 215
7 libc.so.6 0x00007f4a1082279b
8 libc.so.6 0x00007f4a10833b86
9 mojo 0x000055c2416ddef5
10 mojo 0x000055c2416f4d6e
11 mojo 0x000055c2416eca94
12 mojo 0x000055c2416ec946
13 mojo 0x000055c2416a6952
14 mojo 0x000055c24169e96e
15 mojo 0x000055c24169cea9
16 mojo 0x000055c241668d3a
17 mojo 0x000055c2416696ab
18 mojo 0x000055c24126ed3f
19 mojo 0x000055c241259f60
20 mojo 0x000055c24126dc4d
21 mojo 0x000055c2412538fe
22 libc.so.6 0x00007f4a10823a90
23 libc.so.6 0x00007f4a10823b49 __libc_start_main + 137
24 mojo 0x000055c2412530fe
[1] 3191691 IOT instruction (core dumped) mojo run /file.mojo
Bug description
The Mojo parser crashes while trying to unpack an iterable such as a
Tuple
outside of function arguments.Steps to reproduce
[x] Include relevant code snippet or link to code that did not work as expected.
[x] If applicable, add screenshots to help explain the problem.
[x] If using the Playground, name the pre-existing notebook that failed and the steps that led to failure.
[x] Include anything else that might help us debug the issue.
System information