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

Backends that use C FFI are inconsistent with the others on strings with zeros #3161

Open
buzden opened this issue Dec 9, 2023 · 0 comments

Comments

@buzden
Copy link
Contributor

buzden commented Dec 9, 2023

This issue looks really similar to #3158, but this issue, I think, is different. The #3158 is about particular backend, but this feature is about C FFI, available to (and acually used by) many backends.

Steps to Reproduce

Have a program

main : IO ()
main = putStr "abc\00d"

Run it with several standard backends:

$ IDRIS2_CG=chez idris2 --exec main X.idr
$ IDRIS2_CG=racket idris2 --exec main X.idr
$ IDRIS2_CG=node idris2 --exec main X.idr
$ IDRIS2_CG=refc idris2 --exec main X.idr

For the clear repoducibility and independence on the particular terminal, you can pipe those commands with ... | wc -c to count number of printed bytes.

Expected Behavior

All runs print the same thing, namely abcd, or 5 if you run using wc

Observed Behavior

All backends that use C FFI for implementation of putStrLn (and similar functions like fPutStr) print only abc, or 3 if you use wc. The node backend prints abcd (or 5), as expected.

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