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

Unexpected Recursion in Generated C Code #398

Open
gteege opened this issue Mar 31, 2021 · 0 comments
Open

Unexpected Recursion in Generated C Code #398

gteege opened this issue Mar 31, 2021 · 0 comments

Comments

@gteege
Copy link
Contributor

gteege commented Mar 31, 2021

The following example code

h: all acc.  (acc -> acc, acc) -> acc
h (f, i) = f i

f1: U32 -> U32
f1 i = i+1

g: U32 -> U32
g i = h[U32](f1, i)

will cause g and h[U32] to be mutually recursive after translation to C.
The reason is that g and h[U32] have the same type and thus a common dispatcher
function is generated for them and invoked in the C implementation of h.

The effect is that although the C translation fully works, autocorres will fail on the generated C code, since it cannot
generate a nonrecursive definition for g and h[U32].
There seems to be no easy solution for this, but at least Cogent programmers should be made aware of this case.

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

2 participants