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

Compiling quickSort from the standard library results in C compilation errors #1382

Closed
lukaszcz opened this issue Jul 15, 2022 · 1 comment · Fixed by #1832
Closed

Compiling quickSort from the standard library results in C compilation errors #1382

lukaszcz opened this issue Jul 15, 2022 · 1 comment · Fixed by #1832

Comments

@lukaszcz
Copy link
Collaborator

lukaszcz commented Jul 15, 2022

Compiling:

module qs;

open import Stdlib.System.IO;
open import Stdlib.Data.Nat;
open import Stdlib.Data.Nat.Ord;
open import Stdlib.Data.List;

main : IO;
main := putStrLn (natToStr (length (quickSort compare (zero ∷ nil))));

end;

results in

qs.c:359:12: warning: implicit declaration of function 'cmp_462' is invalid in C99 [-Wimplicit-function-declaration]
    return cmp_462(env->ea0, fa1);
           ^
qs.c:359:12: warning: incompatible integer to pointer conversion returning 'int' from a function with result type 'Ordering_61_t *' (aka 'struct Ordering_61_s *') [-Wint-conversion]
    return cmp_462(env->ea0, fa1);
           ^~~~~~~~~~~~~~~~~~~~~~
qs.c:784:127: error: too few arguments to function call, expected 3, have 2
                                                                                                           proj_ca0_V_435(fa1))),
                                                                                                                              ^
2 warnings and 1 error generated.

For now, I propose quickSort be removed from the standard library.

This is the last remaining issue that makes the tests fail after removing MonoJuvix. Earlier quickSort was not compiled unless used -- unused functions were recognised by having a polymorphic type and removed. After removing MonoJuvix, quickSort is compiled every time Stdlib.Data.List is imported.

@lukaszcz
Copy link
Collaborator Author

I think this is the same issue as #1596. It should be fixed with the new backend.

@lukaszcz lukaszcz added this to the 0.3 milestone Dec 23, 2022
@lukaszcz lukaszcz removed the frozen label Dec 23, 2022
@lukaszcz lukaszcz self-assigned this Jan 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants