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

cgen: Free optional string #22068

Closed
esquerbatua opened this issue Aug 17, 2024 · 0 comments · Fixed by #22070
Closed

cgen: Free optional string #22068

esquerbatua opened this issue Aug 17, 2024 · 0 comments · Fixed by #22070
Assignees
Labels
Bug This tag is applied to issues which reports bugs. Option Type Bugs/feature requests, that are related to `?Type`. Unit: cgen Bugs/feature requests, that are related to the default C generating backend.

Comments

@esquerbatua
Copy link
Contributor

esquerbatua commented Aug 17, 2024

Describe the bug

Try to free an structure with a optional string

Reproduction Steps

module main

pub struct Test {
    b ?string
}

fn main() {
    t := Test{
        b: "b"
    }

    println("t: ${t}")

    defer {
        unsafe {
            t.free()
        }
    }
}

Expected Behavior

The program compile and run correctly without errors

Current Behavior

================== C compilation error (from tcc): ==============
cc: /tmp/v_1000/jsonx.01J5G50V9VFVJAHVS165MZ904H.tmp.c:2223: warning: implicit declaration of function '_option_string_free'
cc: /home/esquerbatua/git/v/thirdparty/tcc/lib/libgc.a: error: 'GC_noop1_ptr' defined twice
cc: tcc: error: undefined symbol '_option_string_free'
=================================================================
(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

Current V version: V 0.4.7 e9c9580, timestamp: 2024-08-17 14:34:42 +0300

Environment details (OS name and version, etc.)

V full version: V 0.4.7 4940f2d.e9c9580
OS: linux, Ubuntu 24.04 LTS
Processor: 16 cpus, 64bit, little endian, AMD Ryzen 7 7840HS w/ Radeon 780M Graphics

vexe: /home/esquerbatua/git/v/v
vexe mtime: 2024-08-17 12:30:16

vroot: OK, value: /home/esquerbatua/git/v
VMODULES: OK, value: /home/esquerbatua/.vmodules
VTMP: OK, value: /tmp/v_1000

Git version: git version 2.43.0
Git vroot status: weekly.2024.33-19-ge9c95803
.git/config present: true

CC version: cc (Ubuntu 13.2.0-23ubuntu4) 13.2.0
thirdparty/tcc status: thirdparty-linux-amd64 0134e9b9

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.

@esquerbatua esquerbatua added the Bug This tag is applied to issues which reports bugs. label Aug 17, 2024
@esquerbatua esquerbatua changed the title Free optional string cgen: Free optional string Aug 17, 2024
@felipensp felipensp self-assigned this Aug 17, 2024
@felipensp felipensp added Unit: cgen Bugs/feature requests, that are related to the default C generating backend. Option Type Bugs/feature requests, that are related to `?Type`. labels Aug 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs. Option Type Bugs/feature requests, that are related to `?Type`. Unit: cgen Bugs/feature requests, that are related to the default C generating backend.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants