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 error when using import v.reflection and a struct with field attributes, that have double quotes #23046

Closed
spytheman opened this issue Dec 2, 2024 · 1 comment · Fixed by #23050
Assignees
Labels
Bug This tag is applied to issues which reports bugs. 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. v.reflection

Comments

@spytheman
Copy link
Member

spytheman commented Dec 2, 2024

V doctor:

V full version: V 0.4.8 aeaf607.f2c281e
OS: linux, Ubuntu 20.04.6 LTS
Processor: 4 cpus, 64bit, little endian, Intel(R) Core(TM) i3-3225 CPU @ 3.30GHz

getwd: /space/v/oo
vexe: /home/delian/code/v/v
vexe mtime: 2024-11-29 08:15:02

vroot: OK, value: /home/delian/code/v
VMODULES: OK, value: /home/delian/.vmodules
VTMP: OK, value: /tmp/v_1000

Git version: git version 2.46.0
Git vroot status: weekly.2024.48-24-g7a3e7170-dirty (16 commit(s) behind V master)
.git/config present: true

CC version: cc (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0
emcc version: N/A
thirdparty/tcc status: thirdparty-linux-amd64 0134e9b9

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

import v.reflection as _

struct MyParams {
     p_fpga_ver  string  @[long: fp_ver; name: 'FPGA Version'; xdoc:'String to use as simulated FPGA version in Version responses. Must be in the form "a.bb.cccc"']
     p_cm_ver    string  @[long: cm_ver; name: 'CM Version'; xdoc:'String to use as simulated CM version in Version responses. Must be in the form "a.bb.cccc"']
}     

What did you expect to see?

A compiled program

What did you see instead?

================== C compilation error (from tcc): ==============
cc: /tmp/v_1000/v_reflection_on_attributes_with_double_quotes_cgen_bug.01JE335BE1XPJNKQN1ZZK4TWE5.tmp.c:14625: error: ')' expected (got "a")
=================================================================
(You can pass `-cg`, or `-show-c-output` as well, to print all the C error messages).

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.

Huly®: V_0.6-21486

@spytheman spytheman added Bug This tag is applied to issues which reports bugs. 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. Unit: cgen Bugs/feature requests, that are related to the default C generating backend. v.reflection labels Dec 2, 2024
@spytheman
Copy link
Member Author

spytheman commented Dec 2, 2024

It is related to #23045 , but separate, because the issue there is a heisenbug, while the one here is reproducible always, and probably just involves how the implementation of v.reflection generates strings in cgen.

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. 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. v.reflection
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants