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

Compiler failed while returning array for const init #21114

Closed
akkinenirajesh opened this issue Mar 27, 2024 · 0 comments · Fixed by #21131
Closed

Compiler failed while returning array for const init #21114

akkinenirajesh opened this issue Mar 27, 2024 · 0 comments · Fixed by #21131
Assignees
Labels
Unit: cgen Bugs/feature requests, that are related to the default C generating backend.

Comments

@akkinenirajesh
Copy link

akkinenirajesh commented Mar 27, 2024

V doctor:

V full version: V 0.4.5 22744ce.1e8d1a4
OS: macos, macOS, 13.6.1, 22G313
Processor: 8 cpus, 64bit, little endian, Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz

getwd: /Users/rajesh/dev/buvi
vexe: /Users/rajesh/dev/v/v
vexe mtime: 2024-03-27 13:02:57

vroot: OK, value: /Users/rajesh/dev/v
VMODULES: OK, value: /Users/rajesh/.vmodules
VTMP: OK, value: /tmp/v_502

Git version: git version 2.39.3 (Apple Git-145)
Git vroot status: weekly.2024.13-24-g1e8d1a4d-dirty
.git/config present: true

CC version: Apple clang version 15.0.0 (clang-1500.1.0.2.5)
thirdparty/tcc status: thirdparty-macos-amd64 46662e20

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

const some_arr = make_array()

fn make_array() [64]u8 {
	mut arr := [64]u8{}
	return arr
}

What did you expect to see?

it should compile without any C errors.

What did you see instead?

==================
/tmp/v_502/bugs.01HT01E1J6178EZFQB8P470WH3.tmp.c:13008:24: error: assigning to '_v_Array_fixed_u8_64' (aka 'struct _v_Array_fixed_u8_64') from incompatible type 'u8[64]' (aka 'unsigned char[64]')
        _const_main__some_arr = main__make_array().ret_arr;
                              ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
...
==================
(Use `v -cg` to print the entire error message)

builder error: 
==================
C error. This should never happen.

This is a compiler bug, please report it using `v bug file.v`.

https://github.com/vlang/v/issues/new/choose

You can also use #help on Discord: https://discord.gg/vlang

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.

@felipensp felipensp added the Unit: cgen Bugs/feature requests, that are related to the default C generating backend. label Mar 28, 2024
@felipensp felipensp self-assigned this Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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