Skip to content

AST Checker Panic #24525

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
mike-ward opened this issue May 19, 2025 · 4 comments · Fixed by #24542
Closed

AST Checker Panic #24525

mike-ward opened this issue May 19, 2025 · 4 comments · Fixed by #24542
Assignees
Labels
Bug This tag is applied to issues which reports bugs. Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: Checker Bugs/feature requests, that are related to the type checker.

Comments

@mike-ward
Copy link
Contributor

mike-ward commented May 19, 2025

Describe the bug

Getting a V panic when compiling the split-panel.v in the branch repository of https://github.com/mike-ward/gui/tree/type-panic. Tried undoing my changes to get to the exact spot where it happened, but could not get it to not panic once it started.

Reproduction Steps

Expected Behavior

Should not panic.

Current Behavior

V panic: new_type: idx must be between 1 & 65535
v hash: 171df75
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:19799: at _v_panic: Backtrace
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:40690: by v__ast__new_type
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:55084: by v__checker__Checker_resolve_var_fn
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:55372: by v__checker__Checker_ident
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:53922: by v__checker__Checker_expr
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:70692: by v__checker__Checker_struct_init
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:54383: by v__checker__Checker_expr
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:63415: by v__checker__Checker_method_call
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:61506: by v__checker__Checker_call_expr
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:53743: by v__checker__Checker_expr
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:52845: by v__checker__Checker_stmt
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:53497: by v__checker__Checker_stmts_ending_with_expression
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:53474: by v__checker__Checker_stmts
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:61294: by v__checker__Checker_fn_decl
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:52927: by v__checker__Checker_stmt
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:50816: by v__checker__Checker_check
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:50879: by v__checker__Checker_check_files
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:116112: by v__builder__Builder_middle_stages
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:116150: by v__builder__Builder_front_and_middle_stages
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:118750: by v__builder__cbuilder__gen_c
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:118722: by v__builder__cbuilder__build_c
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:118713: by v__builder__cbuilder__compile_c
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:118630: by v__builder__Builder_rebuild
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:117783: by v__builder__compile
v2.01JVM8S1T644M4X4XE4XTGQZAZ.tmp.c:119148: by main__rebuild

Possible Solution

Could not find one.

Additional Information/Context

Tried to remove a bunch of code, but could not find the spot in split-panel.v where the panic occurred.

V version

V 0.4.10 171df75

Environment details (OS name and version, etc.)

V full version V 0.4.10 da3112e.171df75
OS macos, macOS, 15.4.1, 24E263
Processor 8 cpus, 64bit, little endian, Apple M2
Memory 0.17GB/8GB
V executable /Users/mike/Documents/github/v/v
V last modified time 2025-05-19 12:37:27
V home dir OK, value: /Users/mike/Documents/github/v
VMODULES OK, value: /Users/mike/.vmodules
VTMP OK, value: /tmp/v_501
Current working dir OK, value: /Users/mike/Documents/github/gui/examples
Git version git version 2.49.0
V git status weekly.2025.17-124-g171df75c
.git/config present true
cc version Apple clang version 17.0.0 (clang-1700.0.13.3)
gcc version Apple clang version 17.0.0 (clang-1700.0.13.3)
clang version Apple clang version 17.0.0 (clang-1700.0.13.3)
tcc version tcc version 0.9.28rc 2024-02-05 HEAD@105d70f7 (AArch64 Darwin)
tcc git status thirdparty-macos-arm64 c8df4e27
emcc version N/A
glibc version N/A

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.

@mike-ward mike-ward added the Bug This tag is applied to issues which reports bugs. label May 19, 2025
Copy link

Connected to Huly®: V_0.6-22893

@mike-ward mike-ward changed the title AST Parser Panic AST Checker Panic May 19, 2025
@kbkpbot
Copy link
Contributor

kbkpbot commented May 19, 2025

try to compile with clang or gcc:

v split-panel.v -cc clang

@JalonSolov
Copy link
Contributor

Can also try using v reduce to see if you can narrow down the problem.

@mike-ward
Copy link
Contributor Author

mike-ward commented May 19, 2025

Compiling with clang results in a similar panic.

Commenting out line 61 allows the compiler to work again. There are syntax errors in the code, but no checker faults. Is this sufficient, or do you need more?

fn split_click(cfg &gui.ButtonCfg, mut e gui.Event, mut w gui.Window) {
	w.mouse_lock(gui.MouseLockCfg{
		// mouse_move: mouse_move < ===========
		mouse_up: fn (node &Layout, mut e Event, mut w Window) {
			w.mouse_unlock()
		}
	})
}

@felipensp felipensp self-assigned this May 21, 2025
@felipensp felipensp added Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: Checker Bugs/feature requests, that are related to the type checker. labels May 21, 2025
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. Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: Checker Bugs/feature requests, that are related to the type checker.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants