Skip to content

vlib/v/tests/consts/const_fixed_array_return_unresolved_test.v fails to compile with -no-skip-unused #26306

@dy-tea

Description

@dy-tea

Describe the bug

Code: https://play.vlang.io/p/14b1a1e392

Compiles fine without -no-skip-unused but has a cgen issue with -no-skip-unused.

fn get_chunkmap_at_coords(mapp []Chunk) [chunk_size][chunk_size]u64 {
	return mapp[0].id_map
}

const chunk_size = 100

struct Chunk {
	id_map [chunk_size][chunk_size]u64
}

fn test_main() {
	t := Chunk{}
	assert t.id_map[0].len == 100
	assert t.id_map.len == 100
}

Reproduction Steps

See test.

Expected Behavior

Should compile.

Current Behavior

Output:

/tmp/v_60000/code.01KEJ3GCWSSX56TFQRBHVDR93G.tmp.c:2226: warning: type defaults to int
/tmp/v_60000/code.01KEJ3GCWSSX56TFQRBHVDR93G.tmp.c:2226: error: ';' expected (got "main__get_chunkmap_at_coords")
builder error: 
==================
C error found. It should never happen, when compiling pure V code.
This is a V compiler bug, please report it using `v bug file.v`,
or goto https://github.com/vlang/v/issues/new/choose .
You can also use #help on Discord: https://discord.gg/vlang .
Exited with error status 1

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.5.0 7b22bae.0e098a9

Environment details (OS name and version, etc.)

|V full version      |V 0.5.0 7b22bae12ea108ee51a457a9dd99935ad0c88dc1.0e098a9
|:-------------------|:-------------------
|OS                  |linux, Debian GNU/Linux 12 (bookworm) (VM)
|Processor           |2 cpus, 64bit, little endian, Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz
|Memory              |1.07GB/2.02GB
|                    |
|V executable        |/home/admin/v/v
|V last modified time|2026-01-09 18:25:36
|                    |
|V home dir          |OK, value: /home/admin/v
|VMODULES            |OK, value: .vmodules
|VTMP                |OK, value: /tmp/v_0
|Current working dir |OK, value: /home/admin/playground
|                    |
|Git version         |git version 2.39.5
|V git status        |N/A
|.git/config present |true
|                    |
|cc version          |cc (Debian 12.2.0-14+deb12u1) 12.2.0
|gcc version         |gcc (Debian 12.2.0-14+deb12u1) 12.2.0
|clang version       |Debian clang version 14.0.6
|tcc version         |tcc version 0.9.28rc 2025-02-13 HEAD@f8bd136d (x86_64 Linux)
|tcc git status      |Error: fatal: detected dubious ownership in repository at '/home/admin/v/thirdparty/tcc'
To add an exception for this directory, call:

	git config --global --add safe.directory /home/admin/v/thirdparty/tcc
 Error: fatal: detected dubious ownership in repository at '/home/admin/v/thirdparty/tcc'
To add an exception for this directory, call:

	git config --global --add safe.directory /home/admin/v/thirdparty/tcc

|emcc version        |N/A
|glibc version       |ldd (Debian GLIBC 2.36-9+deb12u10) 2.36

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.

Metadata

Metadata

Assignees

Labels

BugThis tag is applied to issues which reports bugs.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions