roc-lang / roc

A fast, friendly, functional language.
https://roc-lang.org
Universal Permissive License v1.0
4.1k stars 289 forks source link

malloc error at runtime #6924

Open evanrelf opened 1 month ago

evanrelf commented 1 month ago

Tested with Roc https://github.com/roc-lang/roc/commit/d5db3137a3d8da46f92c31b6bf088bc495f759c2 on basic-cli v0.10.0 and v0.12.0.

Commenting out the Arg.list line makes the error go away.

$ cd $(mktemp -d)

$ vim main.roc

$ cat main.roc
#!/usr/bin/env roc
app [main] {
    pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.12.0/Lb8EgiejTUzbggO2HVVuPJFkwvvsfW6LojkLR20kTVE.tar.br",
}

import pf.Arg
import pf.Task exposing [Task]

main : Task {} _
main =
    _args = Arg.list! {}
    Task.ok {}

$ roc build
0 errors and 0 warnings found in 320 ms
 while successfully building:

    main

$ ./main
main(79626,0x1f6954c00) malloc: *** error for object 0x600002f976d8: pointer being freed was not allocated
main(79626,0x1f6954c00) malloc: *** set a breakpoint in malloc_error_break to debug
fish: Job 1, './main' terminated by signal SIGABRT (Abort)
Anton-4 commented 1 month ago

Hi @evanrelf, I believe this issue is due to recent breaking changes in Roc. This error does not occur with a Roc commit from before the breaking changes https://github.com/roc-lang/roc/commit/070d14a5d607b0e765e1182bb760498e44e4d08f. The latest nightly is set to this commit. We should start uploading fresh nightly releases again after basic-cli 0.13 is released, which should happen soon.

If you want to use a recent commit of Roc with basic-cli, you can clone the basic-cli repo and import it locally.

I'll keep this issue open until we confirm it does not happen with basic-cli 0.13.