Skip to content

Concurrent modification error while referring to invalid aliases #4310

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

Closed
Snektron opened this issue Jan 29, 2020 · 3 comments
Closed

Concurrent modification error while referring to invalid aliases #4310

Snektron opened this issue Jan 29, 2020 · 3 comments
Labels
bug Observed behavior contradicts documented or intended behavior stage1 The process of building from source via WebAssembly and the C backend.
Milestone

Comments

@Snektron
Copy link
Collaborator

The following crashes on the latest master (13259ac):

const A = B;

test "Crash" {
    _ = @typeInfo(@This()).Struct.decls;
}

with the message "concurrent modification" and "Panicked during a panic. Aborting.".
Note that the following results in the expected error message "use of undeclared identifier 'B'":

test "No crash" {
    const A = B;
    _ = @typeInfo(@This()).Struct.decls;
}
@andrewrk andrewrk added this to the 0.7.0 milestone Jan 29, 2020
@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior stage1 The process of building from source via WebAssembly and the C backend. labels Jan 29, 2020
@andrewrk
Copy link
Member

This is the c++ compiler's hash map iterator detecting that the hash map was modified while being iterated over, which would be undefined behavior.

@betawaffle
Copy link

This seems to happen reliably for me when getting @typeInfo for a C import.

LemonBoy added a commit to LemonBoy/zig that referenced this issue Feb 16, 2020
Collect the declarations to resolve first and run resolve_top_level_decl
on them later.

Closes ziglang#4310
LemonBoy added a commit to LemonBoy/zig that referenced this issue Feb 16, 2020
Collect the declarations to resolve first and run resolve_top_level_decl
on them later.

Closes ziglang#4310
@FireFox317
Copy link
Contributor

FireFox317 commented Feb 16, 2020

With my PR #4435 this only crashes when doing _ = @typeInfo(@This()).Struct.decls[0];, actually indexing the decls slice forces it to be resolved and just doing .decls doesn't resolve it yet.

Edit: Nvm, this has nothing to do with my PR, since it is not in master yet XD

@andrewrk andrewrk modified the milestones: 0.7.0, 0.6.0 Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior stage1 The process of building from source via WebAssembly and the C backend.
Projects
None yet
Development

No branches or pull requests

4 participants