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

Segfault on TempAllocator.reset from @pool() #1462

Closed
hwchen opened this issue Sep 19, 2024 · 2 comments
Closed

Segfault on TempAllocator.reset from @pool() #1462

hwchen opened this issue Sep 19, 2024 · 2 comments
Assignees
Labels
Bug Something isn't working Fixed Needs Verification Fixed, but needs verification that it works
Milestone

Comments

@hwchen
Copy link
Sponsor

hwchen commented Sep 19, 2024

(gdb) backtrace
#0  0x00000000004328c8 in std.core.mem.allocator.TempAllocator.reset (self=0x7ffff7c95010, mark=136)
    at /nix/store/ncv46wwhpya58snvmlvymvpazhz6vzpi-c3c-0.6.2/lib/c3/std/core/allocators/temp_allocator.c3:83
#1  0x000000000040743c in @pool () at /nix/store/ncv46wwhpya58snvmlvymvpazhz6vzpi-c3c-0.6.2/lib/c3/std/core/mem.c3:523
#2  segfault.main () at segfault.c3:11
#3  0x00000000004074a2 in @main_to_void_main ()
    at /nix/store/ncv46wwhpya58snvmlvymvpazhz6vzpi-c3c-0.6.2/lib/c3/std/core/private/main_stub.c3:18
#4  main (.anon=0x7fffffffb488, .anon=0x7fffffffb488) at segfault.c3:8
module segfault;

import std::collections::map;

const int LIMIT = 100000;

fn void main() {
    map::HashMap(<long, char>) set;
    set.temp_init();
    @pool() {
        for (long i; i < LIMIT; i++) {
            set.set(i, 0);
        }
    };
}
c3c compile segfault.c3

Probably not the smallest reproduction, but the snippet is derived from the project I was working on. Lowering the limit does not trigger segfault on my computer (Ubuntu 22.04 amd64).

Let me know if there's anything else I can do. Might try to look at this if I have time.

@lerno lerno self-assigned this Sep 19, 2024
@lerno lerno added the Bug Something isn't working label Sep 19, 2024
@lerno lerno added the Fixed Needs Verification Fixed, but needs verification that it works label Sep 19, 2024
@lerno
Copy link
Collaborator

lerno commented Sep 19, 2024

Thank you for finding this! I've issued a fix, please check that it is handled in the latest build.

@hwchen
Copy link
Sponsor Author

hwchen commented Sep 19, 2024

Looks like it works!

@hwchen hwchen closed this as completed Sep 19, 2024
@lerno lerno added this to the 0.6.3 milestone Sep 19, 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 Fixed Needs Verification Fixed, but needs verification that it works
Projects
None yet
Development

No branches or pull requests

2 participants