Skip to content
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] Segmentation fault when getting list of values from tuple #2640

Open
ltjkoomen opened this issue May 13, 2024 · 0 comments
Open

[BUG] Segmentation fault when getting list of values from tuple #2640

ltjkoomen opened this issue May 13, 2024 · 0 comments
Labels
bug Something isn't working mojo-repo Tag all issues with this label

Comments

@ltjkoomen
Copy link

ltjkoomen commented May 13, 2024

Bug description

I get a segmentation fault when trying to get a list of value structs from a tuple. I believe the ability to get such items from a tuple was added recently when solving this issue: #1187 , so perhaps something went wrong there?

I've included a minimal example below.

Steps to reproduce

Include relevant code snippet or link to code that did not work as expected.
I've come to this minimal example of the issue:

@value
struct Foo:
    var x: Int32


fn some_func() -> Tuple[List[Foo]]:
    var foos = List[Foo]()
    foos.append(Foo(0))
    foos.append(Foo(0))
    return (foos,)


fn main():
    for i in range(12):
        var out = some_func()
        var foos = out.get[0, List[Foo]]()

The issue seems sensitive to the amount of times I do .append in some_func, the number of times I iterate in the loop, and the type of Foo.x:

  • With only a single .append I don't get the crash
  • Per type of Foo.x I get the following minimum number of iterations before it crashes:
    • Int and Int64: 7
    • Int16 and Int32: 12

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.
This is the stack dump I get:

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 issue.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                               0x00005e276a98c407
1  mojo                               0x00005e276a98a25e
2  mojo                               0x00005e276a98ca9f
3  libc.so.6                          0x00007e14d8842520
4  mojo                               0x00005e276c1593d6
5  mojo                               0x00005e276c169104
6  mojo                               0x00005e276c1692e8
7  mojo                               0x00005e276c168364
8  mojo                               0x00005e276c16815b
9  mojo                               0x00005e276cdb9ece
10 libKGENCompilerRTShared.so.19.0git 0x00007e14ccc3b848 KGEN_CompilerRT_AlignedFree + 104
11 libKGENCompilerRTShared.so.19.0git 0x00007e14840011fc KGEN_CompilerRT_AlignedFree + 18446744072488770076
mojo crashed!
Please file a bug report.
[1]    40994 segmentation fault (core dumped)  mojo issue.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)
@ltjkoomen ltjkoomen added bug Something isn't working mojo-repo Tag all issues with this label labels May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

1 participant