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

-itypes-for-extern rewrites itype parameters even when they don't need to be changed #715

Open
john-h-kastner opened this issue Sep 28, 2021 · 0 comments

Comments

@john-h-kastner
Copy link
Collaborator

john-h-kastner commented Sep 28, 2021

For example:

void test(int *a : itype(_Ptr<int>)) {}

When converted with 3c -itypes-for-extern, the function is rewritten even though it hasn't changed.

This can break idempotence in some situations:

#define foo int
void test(foo *a) {}

converts (3c -itypes-for-extern) to

#define foo int
void test(int *a : itype(_Ptr<foo>)) {}

but a further pass through 3c gives

#define foo int
void test(int *a : itype(_Ptr<int>)) {}

A fix should be fairly straight forward. The condition for rewriting with an itype under -itypes-for-extern just needs to have a srcHasItype check. Alternatively, a fix could come via the change suggested by matt here (update: now filed as #740). If the internal constraint solves to WILD, and the special casing in the rewriter is removed, the main itype rewriting logic will correctly notice the existing itype and not rewrite.

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

No branches or pull requests

1 participant