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

Runtime error when print struct with uninitialized field of interface type #18718

Open
i582 opened this issue Jun 30, 2023 · 1 comment · May be fixed by #18733
Open

Runtime error when print struct with uninitialized field of interface type #18718

i582 opened this issue Jun 30, 2023 · 1 comment · May be fixed by #18733
Labels
Bug This tag is applied to issues which reports bugs. Unit: Checker Bugs/feature requests, that are related to the type checker.

Comments

@i582
Copy link
Contributor

i582 commented Jun 30, 2023

Describe the bug

Code: https://vosca.dev/p/8cba48032c

interface Some {}

struct Foo {
	name Some
}

a := Foo{}
println(a)

Expected Behavior

No runtime error

Current Behavior

Output:

/tmp/v_60000/code.17284851134424006581.tmp.c:2180: at indent_main__Some_str: RUNTIME ERROR: invalid memory access
/tmp/v_60000/code.17284851134424006581.tmp.c:2167: by indent_main__Foo_str
/tmp/v_60000/code.17284851134424006581.tmp.c:2158: by main__Foo_str
/tmp/v_60000/../../../../../../box/code.v:8: by main__main
/tmp/v_60000/../../../../../../tmp/v_60000/code.17284851134424006581.tmp.c:17332: by main
Exited with error status 255

Reproduction Steps

Run code above

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.3.4 fc4c431.45f16a2

Environment details (OS name and version, etc.)

V full version: V 0.3.5 fc4c431.015ccc2
OS: linux, Ubuntu 22.04.2 LTS
Processor: 2 cpus, 64bit, little endian, Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz

getwd: /home/pmakhnev/playground
vexe: /home/pmakhnev/v/v
vexe mtime: 2023-06-30 00:00:09

vroot: OK, value: /home/pmakhnev/v
VMODULES: OK, value: /root/.vmodules
VTMP: OK, value: /tmp/v_0

Git version: git version 2.34.1
Git vroot status: weekly.2023.26-31-g015ccc2a
.git/config present: true

CC version: cc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3
@i582 i582 added the Bug This tag is applied to issues which reports bugs. label Jun 30, 2023
@felipensp
Copy link
Member

This is the comment on the code:

TODO: should be an error instead, but first ui needs updating.

@felipensp felipensp added the Unit: Checker Bugs/feature requests, that are related to the type checker. label Jul 1, 2023
@i582 i582 closed this as completed Nov 25, 2023
@medvednikov medvednikov reopened this Nov 25, 2023
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. Unit: Checker Bugs/feature requests, that are related to the type checker.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants