Skip to content

-autofree fails on if statement containing strings #22073

@Checkmate6659

Description

@Checkmate6659

V doctor:

V full version: V 0.4.7 f879368.3965a6c
OS: linux, Ubuntu 20.04.6 LTS
Processor: 8 cpus, 64bit, little endian, AMD Ryzen 5 2500U with Radeon Vega Mobile Gfx

getwd: /home/enigma/vlang/bober_mini
vexe: /home/enigma/vlang/v/v
vexe mtime: 2024-08-18 18:33:11

vroot: OK, value: /home/enigma/vlang/v
VMODULES: OK, value: /home/enigma/.vmodules
VTMP: OK, value: /tmp/v_1000

Git version: git version 2.25.1
Git vroot status: weekly.2024.33-26-g3965a6c5
.git/config present: true

CC version: cc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
thirdparty/tcc status: thirdparty-linux-amd64 0134e9b9

What did you do?
./v -g -o vdbg cmd/v && ./vdbg src/main.v

module main

fn main() {
	x := 42
	println(if x == 69 {"A"} else {"B"})
}

What did you expect to see?

When the program is compiled normally, B gets printed, as expected. When compiled with -autofree, a C error appears.

What did you see instead?

B

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

No one assigned

    Labels

    AutofreeBugs/feature requests, that are related to -autofree.BugThis tag is applied to issues which reports bugs.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.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions