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

compile time reflection crash when using .params #22411

Open
kbkpbot opened this issue Oct 5, 2024 · 1 comment
Open

compile time reflection crash when using .params #22411

kbkpbot opened this issue Oct 5, 2024 · 1 comment
Assignees
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@kbkpbot
Copy link
Contributor

kbkpbot commented Oct 5, 2024

Describe the bug

When compile a compile time reflection v code, compiler will crash.

Reproduction Steps

hello.v

struct Test {
}

fn main() {
	$for f in Test.params {
		println(f)
	}
}

Expected Behavior

Compiler should not crash.

Current Behavior

Compiler crash :

/tmp/v_1000/v2.01J9BZ6PA7SRDB5Q0WPWYXXZ05.tmp.c:46768: at v__gen__c__Gen_comptime_for: RUNTIME ERROR: invalid memory access
/tmp/v_1000/v2.01J9BZ6PA7SRDB5Q0WPWYXXZ05.tmp.c:39297: by v__gen__c__Gen_stmt
/tmp/v_1000/v2.01J9BZ6PA7SRDB5Q0WPWYXXZ05.tmp.c:39119: by v__gen__c__Gen_stmts_with_tmp_var
/tmp/v_1000/v2.01J9BZ6PA7SRDB5Q0WPWYXXZ05.tmp.c:39025: by v__gen__c__Gen_stmts
/tmp/v_1000/v2.01J9BZ6PA7SRDB5Q0WPWYXXZ05.tmp.c:48167: by v__gen__c__Gen_gen_fn_decl
/tmp/v_1000/v2.01J9BZ6PA7SRDB5Q0WPWYXXZ05.tmp.c:47755: by v__gen__c__Gen_fn_decl
/tmp/v_1000/v2.01J9BZ6PA7SRDB5Q0WPWYXXZ05.tmp.c:39335: by v__gen__c__Gen_stmt
/tmp/v_1000/v2.01J9BZ6PA7SRDB5Q0WPWYXXZ05.tmp.c:39119: by v__gen__c__Gen_stmts_with_tmp_var
/tmp/v_1000/v2.01J9BZ6PA7SRDB5Q0WPWYXXZ05.tmp.c:39025: by v__gen__c__Gen_stmts
/tmp/v_1000/v2.01J9BZ6PA7SRDB5Q0WPWYXXZ05.tmp.c:37917: by v__gen__c__Gen_gen_file
/tmp/v_1000/v2.01J9BZ6PA7SRDB5Q0WPWYXXZ05.tmp.c:37859: by v__gen__c__cgen_process_one_file_cb
/tmp/v_1000/v2.01J9BZ6PA7SRDB5Q0WPWYXXZ05.tmp.c:48390: by sync__pool__process_in_thread
/tmp/v_1000/v2.01J9BZ6PA7SRDB5Q0WPWYXXZ05.tmp.c:12014: by sync__pool__process_in_thread_thread_wrapper
0x7c00d1e9ca94: by ???
0x7c00d1f29c3c: by ???

Possible Solution

Fix checker?

Additional Information/Context

No response

V version

V full version: V 0.4.8 7b8e059.0390c07

Environment details (OS name and version, etc.)

V full version: V 0.4.8 7b8e059.0390c07
OS: linux, Ubuntu 24.04.1 LTS
Processor: 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz

getwd: /home/mars/v/toml
vexe: /media/HD/github/kbkpbot/v/v
vexe mtime: 2024-10-04 14:33:40

vroot: OK, value: /media/HD/github/kbkpbot/v
VMODULES: OK, value: /home/mars/.vmodules
VTMP: OK, value: /tmp/v_1000

Git version: git version 2.43.0
Git vroot status: weekly.2024.30-404-g209c30f3
.git/config present: true

CC version: cc (Ubuntu 13.2.0-23ubuntu4) 13.2.0
thirdparty/tcc status: thirdparty-linux-amd64 0134e9b9

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.

@kbkpbot kbkpbot added the Bug This tag is applied to issues which reports bugs. label Oct 5, 2024
@JalonSolov
Copy link
Contributor

Probably because structs don't have params... functions do. Definitely something that needs to be checked.

@Delta456 Delta456 self-assigned this Oct 5, 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.
Projects
None yet
Development

No branches or pull requests

3 participants