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

can't compile pass, i try the second condition alone, or in 'if condition', it's ok, but if it is in 'else if condition', not works #23903

Open
jemuky opened this issue Mar 11, 2025 · 1 comment
Labels
Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: cgen Bugs/feature requests, that are related to the default C generating backend. Unit: Compiler Bugs/feature requests, that are related to the V compiler in general.

Comments

@jemuky
Copy link

jemuky commented Mar 11, 2025

V version: V 0.4.9 4cc6f25, press to see full `v doctor` output
V full version V 0.4.9 f4b51d0.4cc6f25
OS windows, Microsoft Windows 10 专业版 19045 64-bit
Processor 16 cpus, 64bit, little endian, AMD Ryzen 7 4700G with Radeon Graphics
Memory 10.06GB/31.36GB
V executable D:\psoft\v\v.exe
V last modified time 2025-03-11 07:01:22
V home dir OK, value: D:\psoft\v
VMODULES OK, value: D:\psoft\v.vmodules
VTMP OK, value: C:\Users\v_dliweili\AppData\Local\Temp\v_0
Current working dir OK, value: D:\space\other\v_test
Git version git version 2.35.1.windows.2
V git status weekly.2025.11-2-g4cc6f254
.git/config present true
cc version N/A
gcc version gcc (x86_64-win32-seh-rev1, Built by MinGW-Builds project) 13.1.0
clang version clang version 15.0.7
msvc version 用于 x86 的 Microsoft (R) C/C++ 优化编译器 19.29.30158 版
tcc version tcc version 0.9.27 (x86_64 Windows)
tcc git status thirdparty-windows-amd64 b425ac82
emcc version N/A
glibc version ldd (cygwin) 3.3.3

What did you do?
./v -g -o vdbg cmd/v && ./vdbg .\src\main.v && D:\space\other\v_test\src\main.exe

module main

// import main2

fn main() {
	// println(main2.fac)

	println(response('asdffsda?'))
}

fn response(hey_bob string) string {
	return if hey_bob.ends_with('?') {
		'Sure.'
	} else if hey_bob.runes().all(fn (c rune) bool {
		return c >= 65 && c <= 90
	}){
		'Whoa, chill out!'
	} else {
		'123'
	}
}

What did you see?

================== C compilation error (from tcc): ==============
cc: C:/Users/v_dliweili/AppData/Local/Temp/v_0/main.01JP209KEEN7C40A6TSXWGF7T1.tmp.c:3773: warning: implicit declaration of function 'tcc_backtrace'
cc: C:/Users/v_dliweili/AppData/Local/Temp/v_0/main.01JP209KEEN7C40A6TSXWGF7T1.tmp.c:5832: error: '_t3' undeclared
...
cc: C:/Users/v_dliweili/AppData/Local/Temp/v_0/main.01JP209KEEN7C40A6TSXWGF7T1.tmp.c:5832: error: '_t3' undeclared
(note: the original output was 3 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?

compile pass

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-22305

@spytheman spytheman added Unit: cgen Bugs/feature requests, that are related to the default C generating backend. Unit: Compiler Bugs/feature requests, that are related to the V compiler in general. Status: Confirmed This bug has been confirmed to be valid by a contributor. labels Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Confirmed This bug has been confirmed to be valid by a contributor. Unit: cgen Bugs/feature requests, that are related to the default C generating backend. Unit: Compiler Bugs/feature requests, that are related to the V compiler in general.
Projects
None yet
Development

No branches or pull requests

2 participants