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
When declaring a struct that contains a variable of its own type, the code crashes. This issue is not limited to any specific struct but occurs with any struct that includes a variable of the same struct type. The expected behavior is for the code to compile without errors, but it results in a crash instead.
This issue appears to be related to the recursive nature of the struct declaration, where a struct contains a variable of its own type. This problem is critical as it affects the ability to define common data structures like linked lists, trees, and others that require self-referential types.
Steps to reproduce
issue code
@valuestructNode:
vardata: Int
varnext: Optional[Node]
Crash log
[34229:34229:20240612,222743.659602:WARNING process_reader_linux.cc:144] no stack mapping
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: /home/guna/.modular/pkg/packages.modular.com_mojo/bin/mojo /home/guna/Projects/new/test.mojo
[34229:34230:20240612,222743.692664:ERROR directory_reader_posix.cc:42] opendir /home/guna/.modular/crashdb/attachments/542b6caf-68ed-4ad1-9bf0-6a0f03aa4c0d: No such file or directory (2)
#0 0x000059c6b1289438 (/home/guna/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x12a1438) #1 0x000059c6b128725e (/home/guna/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x129f25e) #2 0x000059c6b1289acd (/home/guna/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x12a1acd)
... #255 0x000059c6b17c1950 (/home/guna/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x17d9950)
mojo crashed!
Please file a bug report.
Segmentation fault (core dumped)
Bug description
When declaring a struct that contains a variable of its own type, the code crashes. This issue is not limited to any specific struct but occurs with any struct that includes a variable of the same struct type. The expected behavior is for the code to compile without errors, but it results in a crash instead.
This issue appears to be related to the recursive nature of the struct declaration, where a struct contains a variable of its own type. This problem is critical as it affects the ability to define common data structures like linked lists, trees, and others that require self-referential types.
Steps to reproduce
issue code
Crash log
[34229:34229:20240612,222743.659602:WARNING process_reader_linux.cc:144] no stack mapping
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: /home/guna/.modular/pkg/packages.modular.com_mojo/bin/mojo /home/guna/Projects/new/test.mojo
[34229:34230:20240612,222743.692664:ERROR directory_reader_posix.cc:42] opendir /home/guna/.modular/crashdb/attachments/542b6caf-68ed-4ad1-9bf0-6a0f03aa4c0d: No such file or directory (2)
#0 0x000059c6b1289438 (/home/guna/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x12a1438)
#1 0x000059c6b128725e (/home/guna/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x129f25e)
#2 0x000059c6b1289acd (/home/guna/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x12a1acd)
...
#255 0x000059c6b17c1950 (/home/guna/.modular/pkg/packages.modular.com_mojo/bin/mojo+0x17d9950)
mojo crashed!
Please file a bug report.
Segmentation fault (core dumped)
System information
The text was updated successfully, but these errors were encountered: