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

Usage of abstract can make the compiler generate no C code without error #241

Open
antoyo opened this issue Apr 4, 2019 · 3 comments
Open

Comments

@antoyo
Copy link

antoyo commented Apr 4, 2019

Hi.
The following code:

#define ATS_DYNLOADFLAG 0

absvt@ype A

vtypedef D = [l1:addr] (!A@l1 | ptr l1) -> void

vtypedef B = D

vtypedef C = B

extern fun func(arg: !C): int

assume A = B

implement func(arg) =
    0

implement main0() = ()

causes the compiler to generate an empty C file without printing any error message.
Can you please fix this?
Do you know why this code is wrong?
Thanks.

@githwxi
Copy link
Owner

githwxi commented Apr 4, 2019

This code is not supported because 'A' is recursively defined, that is, the definition of 'A' makes use of 'A'.

@antoyo
Copy link
Author

antoyo commented Apr 4, 2019

Yeah, but A makes use a A behind a pointer, behind a function pointer, so I guess that could be supported.

Any in case, that should produce a meaningful error, because not producing code is misleading.

@githwxi
Copy link
Owner

githwxi commented Apr 4, 2019

Checking for recursive definition is not currently performed by patsopt. The crash you experienced was due to the expansion of A, which is not terminating.

Instead of using 'assume', you may want to use casting to circumvent the issue.

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

2 participants