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

Error printing string u8_array #23926

Closed
JaRoLoz opened this issue Mar 13, 2025 · 3 comments · Fixed by #23931
Closed

Error printing string u8_array #23926

JaRoLoz opened this issue Mar 13, 2025 · 3 comments · Fixed by #23931
Labels
Arrays Bugs involving the builtin `array` type and derivatives from it like `[]int`, `[]string` etc. Bug This tag is applied to issues which reports bugs. Maps Bugs involving the builtin `map` type and derivatives from it like `map[string]int` etc. Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: markused Bugs/feature requests, that are related to the -skip-unused.

Comments

@JaRoLoz
Copy link

JaRoLoz commented Mar 13, 2025

V version: V 0.4.9 6623ac2, press to see full `v doctor` output
V full version V 0.4.9 6623ac2
OS windows, Microsoft Windows 11 Pro 26100 64 bits
Processor 16 cpus, 64bit, little endian, AMD Ryzen 7 3700X 8-Core Processor
Memory 17.58GB/31.93GB
V executable C:\bin\v\v.exe
V last modified time 2025-03-10 09:13:02
V home dir OK, value: C:\bin\v
VMODULES OK, value: C:\Users\Jaime.vmodules
VTMP OK, value: C:\Users\Jaime\AppData\Local\Temp\v_0
Current working dir OK, value: C:\Users\Jaime\Desktop\vs-code\v\jade_v
Git version git version 2.47.1.windows.2
V git status Error: fatal: not a git repository (or any of the parent directories): .git
.git/config present false
cc version N/A
gcc version gcc (GCC) 13.2.0
clang version N/A
msvc version N/A
tcc version tcc version 0.9.27 (x86_64 Windows)
tcc git status N/A
emcc version N/A
glibc version N/A

What did you do?
./v -g -o vdbg cmd/v && ./vdbg .\src\main.v && C:\Users\Jaime\Desktop\vs-code\v\jade_v\src\main.exe

module main

fn main() {
    a := "dfgdfgfgd"
	println(a.u8_array())
}

What did you see?

================== C compilation error (from tcc): ==============
cc: C:/Users/Jaime/AppData/Local/Temp/v_0/main.01JP83YP1Q6RVGSGSCJ4DEKYN7.tmp.c:5385: warning: implicit declaration of function 'array_set'
cc: tcc: error: undefined symbol 'array_set'
...
cc: tcc: error: undefined symbol 'array_set'
(note: the original output was 4 lines long; it was truncated to its first 2 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 .

What did you expect to see?

The array of characters that make up the string printed in the stdout

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.

Copy link

Connected to Huly®: V_0.6-22324

@jorgeluismireles
Copy link

This works:

fn main() {
	assert '0xfe9a'.u8_array() == [u8(0xfe), 0x9a]
	assert 'dfgdfgfgd'.u8_array() == []
}

But commenting the first line we got the error:

fn main() {
	//assert '0xfe9a'.u8_array() == [u8(0xfe), 0x9a]
	assert 'dfgdfgfgd'.u8_array() == []
}
Can't run code. The server returned an error:
/tmp/v_60000/../../../../../../home/admin/v/vlib/builtin/string.v:675: warning: implicit declaration of function 'array_set'
/home/admin/v/thirdparty/tcc/lib/libgc.a: error: 'GC_noop1_ptr' defined twice
tcc: error: undefined symbol 'array_set'

@ChAoSUnItY
Copy link
Member

ChAoSUnItY commented Mar 14, 2025

I've concluded the cause of this error, currently u8_array is as expected marked used and its statements are also walked and marked, but for IndexExpr, it did not mark array get / set. I will later submit a patch for this.

@ChAoSUnItY ChAoSUnItY added Bug This tag is applied to issues which reports bugs. Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: markused Bugs/feature requests, that are related to the -skip-unused. Maps Bugs involving the builtin `map` type and derivatives from it like `map[string]int` etc. Arrays Bugs involving the builtin `array` type and derivatives from it like `[]int`, `[]string` etc. labels Mar 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arrays Bugs involving the builtin `array` type and derivatives from it like `[]int`, `[]string` etc. Bug This tag is applied to issues which reports bugs. Maps Bugs involving the builtin `map` type and derivatives from it like `map[string]int` etc. Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: markused Bugs/feature requests, that are related to the -skip-unused.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants