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

Add support for struct assignement. #92

Open
HPCguy opened this issue Feb 14, 2022 · 0 comments
Open

Add support for struct assignement. #92

HPCguy opened this issue Feb 14, 2022 · 0 comments

Comments

@HPCguy
Copy link
Contributor

HPCguy commented Feb 14, 2022

Struct/union assignments are not currently allowed, since they require moving mem blocks:

struct foo s1, s2;
s1 = s2;  // not allowed

That said, the AST tracks all the type information needed to support this. Assignment/copy just needs to be converted to a SYSC to memcpy(). Also, for function return values and parameters, the C-standard ABI conventions need to be followed. I looked at the C89 standard and didn't see it spelled out. Some compilers used to convert struct parameters to pointers automatically if the struct size exceeded a certain limit, and I am not sure what the rules are now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant