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

V panics when using shared variable #15649

Closed
JulienLecoq opened this issue Sep 3, 2022 · 0 comments · Fixed by #19751
Closed

V panics when using shared variable #15649

JulienLecoq opened this issue Sep 3, 2022 · 0 comments · Fixed by #19751
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@JulienLecoq
Copy link

V version: V 0.3.1 d6de533.5e1a2f6
OS: linux, Ubuntu 20.04.3 LTS

What did you do?

module main

fn test(shared values []int) {
	values = [2]
}

fn main() {
	shared values := [3, 3, 3]
	go test(shared values)
}

What did you expect to see?
An error explaining that values = [2] must be surrounded by a lock {} block.

What did you see instead?
V panic: deref: type ast.Type(0x25 = 37) is not a pointer
v hash: 5e1a2f6
/tmp/v_1001/v2.7703826891864608901.tmp.c:19515: at _v_panic: Backtrace
/tmp/v_1001/v2.7703826891864608901.tmp.c:46901: by v__ast__Type_deref
/tmp/v_1001/v2.7703826891864608901.tmp.c:647: by v__gen__c__Gen_assign_stmt
/tmp/v_1001/v2.7703826891864608901.tmp.c:4673: by v__gen__c__Gen_stmt
/tmp/v_1001/v2.7703826891864608901.tmp.c:4613: by v__gen__c__Gen_stmts_with_tmp_var
/tmp/v_1001/v2.7703826891864608901.tmp.c:4546: by v__gen__c__Gen_stmts
/tmp/v_1001/v2.7703826891864608901.tmp.c:10918: by v__gen__c__Gen_gen_fn_decl
/tmp/v_1001/v2.7703826891864608901.tmp.c:10602: by v__gen__c__Gen_fn_decl
/tmp/v_1001/v2.7703826891864608901.tmp.c:4793: by v__gen__c__Gen_stmt
/tmp/v_1001/v2.7703826891864608901.tmp.c:4613: by v__gen__c__Gen_stmts_with_tmp_var
/tmp/v_1001/v2.7703826891864608901.tmp.c:4546: by v__gen__c__Gen_stmts
/tmp/v_1001/v2.7703826891864608901.tmp.c:3580: by v__gen__c__Gen_gen_file
/tmp/v_1001/v2.7703826891864608901.tmp.c:3525: by v__gen__c__cgen_process_one_file_cb
/tmp/v_1001/v2.7703826891864608901.tmp.c:40825: by sync__pool__process_in_thread
/tmp/v_1001/v2.7703826891864608901.tmp.c:10740: by sync__pool__process_in_thread_thread_wrapper
7fe0ffd3e609 : by ???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant