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

C error when running a function that returns a reference in a thread #20836

Closed
squidink7 opened this issue Feb 15, 2024 · 0 comments · Fixed by #20850
Closed

C error when running a function that returns a reference in a thread #20836

squidink7 opened this issue Feb 15, 2024 · 0 comments · Fixed by #20850
Assignees
Labels
Bug This tag is applied to issues which reports bugs. Unit: cgen Bugs/feature requests, that are related to the default C generating backend.

Comments

@squidink7
Copy link
Contributor

squidink7 commented Feb 15, 2024

Describe the bug

When running a function that returns a reference with spawn, the V compiler generates a C error

Reproduction Steps

fn main() {
	foo := spawn get_pointer()
}

fn get_pointer() &int {
	val := 42
	return &val
}

Expected Behavior

the code to run without errors

Current Behavior

==================
/tmp/v_1000/cerror.01HPN17PE89B6R6R694Y84XW20.tmp.c:2103: error: ',' expected (got "thread")
...
==================

Possible Solution

No response

Additional Information/Context

No response

V version

0.4.4

Environment details (OS name and version, etc.)

V full version: V 0.4.4 c5a6aeb.ca45311
OS: linux, "Arch Linux"
Processor: 12 cpus, 64bit, little endian, AMD Ryzen 5 7640U w/ Radeon 760M Graphics

getwd: /home/sirsegv
vexe: /home/sirsegv/.v/v
vexe mtime: 2024-02-14 00:45:40

vroot: OK, value: /home/sirsegv/.v
VMODULES: OK, value: /home/sirsegv/.vmodules
VTMP: OK, value: /tmp/v_1000

Git version: git version 2.43.1
Git vroot status: 0.4.4-260-gca453117 (5 commit(s) behind V master)
.git/config present: true

CC version: cc (GCC) 13.2.1 20230801
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@squidink7 squidink7 added the Bug This tag is applied to issues which reports bugs. label Feb 15, 2024
@felipensp felipensp self-assigned this Feb 16, 2024
@felipensp felipensp added the Unit: cgen Bugs/feature requests, that are related to the default C generating backend. label Feb 16, 2024
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. Unit: cgen Bugs/feature requests, that are related to the default C generating backend.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants