Skip to content

markused: builtin__memdup not included when using tcc #25801

Description

@dy-tea

Describe the bug

See included code.
Compiles with -no-skip-unused.
Works when using -cc gcc or -cc clang.
Works when using -g and on V playground.
Does not work with -no-parallel.

Reproduction Steps

struct Foo {
	data &int
}

struct FooHolder {
	foo ?&Foo
}

struct Program {
	foo ?&Foo
}

fn main() {
	p := Program{}
}

Expected Behavior

Should compile normally (with warning of unused variable).

Current Behavior

❯ v run x.v
x.v:14:2: warning: unused variable: `p`
   12 |
   13 | fn main() {
   14 |     p := Program{}
      |     ^
   15 | }
================== C compilation error (from tcc): ==============
cc: /tmp/v_1000/x.01KAJXHTB2K9TN8BQHE7A9ANBX.tmp.c:1214: warning: cast between pointer and integer of different size
cc: /home/dylan/Repos/v/thirdparty/tcc/lib/libgc.a: error: 'GC_noop1_ptr' defined twice
cc: tcc: error: undefined symbol 'builtin__memdup'
...
cc: tcc: error: undefined symbol 'builtin__memdup'
(note: the original output was 4 lines long; it was truncated to its first 3 lines + the last line)
=================================================================
(You can pass `-cg`, or `-show-c-output` as well, to print all the C error messages).
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 .

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.12 a8e0120

Environment details (OS name and version, etc.)

|V full version      |V 0.4.12 a8e012049525be195c0af1de248fbda476398ce3
|:-------------------|:-------------------
|OS                  |linux, "CachyOS"
|Processor           |12 cpus, 64bit, little endian, 13th Gen Intel(R) Core(TM) i5-1335U
|Memory              |7.71GB/15.31GB
|                    |
|V executable        |/home/dylan/Repos/v/v
|V last modified time|2025-11-21 09:21:41
|                    |
|V home dir          |OK, value: /home/dylan/Repos/v
|VMODULES            |OK, value: /home/dylan/.vmodules
|VTMP                |OK, value: /tmp/v_1000
|Current working dir |OK, value: /home/dylan/Repos/v
|                    |
|Git version         |git version 2.52.0
|V git status        |weekly.2025.42-208-ga8e01204
|.git/config present |true
|                    |
|cc version          |cc (GCC) 15.2.1 20251112
|gcc version         |gcc (GCC) 15.2.1 20251112
|clang version       |clang version 21.1.5
|tcc version         |tcc version 0.9.28rc 2025-02-13 HEAD@f8bd136d (x86_64 Linux)
|tcc git status      |thirdparty-linux-amd64 696c1d84
|emcc version        |N/A
|glibc version       |ldd (GNU libc) 2.42

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.Option TypeBugs/feature requests, that are related to `?Type`.Status: ConfirmedThis bug has been confirmed to be valid by a contributor.Unit: CompilerBugs/feature requests, that are related to the V compiler in general.Unit: cgenBugs/feature requests, that are related to the default C generating backend.Unit: markusedBugs/feature requests, that are related to the -skip-unused.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions