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

Compiler assert when using _ as an argument to Array #2157

Closed
dipinhora opened this issue Aug 12, 2017 · 0 comments
Closed

Compiler assert when using _ as an argument to Array #2157

dipinhora opened this issue Aug 12, 2017 · 0 comments
Assignees

Comments

@dipinhora
Copy link
Contributor

In the following code:

actor Main
  new create(env:Env) =>
    let a = Array[U8]
    a.push(_)

The last line causes the following assert in the compiler:

vagrant@buffy-leader-1:~/ponyc$ ./build/debug/ponyc -d z
Building builtin -> /home/vagrant/ponyc/packages/builtin
Building z -> /home/vagrant/ponyc/z
src/libponyc/type/safeto.c:51: safe_field_write: Assertion `0` failed.

Backtrace:
  ./build/debug/ponyc(ponyint_assert_fail+0xe9) [0x71da60]
  ./build/debug/ponyc() [0x712f1d]
  ./build/debug/ponyc(safe_to_autorecover+0x123) [0x7132af]
  ./build/debug/ponyc() [0x6f6c0a]
  ./build/debug/ponyc() [0x6f6e92]
  ./build/debug/ponyc() [0x6f7675]
  ./build/debug/ponyc() [0x6f77d0]
  ./build/debug/ponyc(expr_call+0xf4) [0x6fa867]
  ./build/debug/ponyc(pass_expr+0x223) [0x66f3c1]
  ./build/debug/ponyc(ast_visit+0x261) [0x66d7c4]
  ./build/debug/ponyc(ast_visit+0x1b3) [0x66d716]
  ./build/debug/ponyc(ast_visit+0x1b3) [0x66d716]
  ./build/debug/ponyc(ast_visit+0x1b3) [0x66d716]
  ./build/debug/ponyc(ast_visit+0x1b3) [0x66d716]
  ./build/debug/ponyc(ast_visit+0x1b3) [0x66d716]
  ./build/debug/ponyc(ast_visit+0x1b3) [0x66d716]
  ./build/debug/ponyc(ast_visit+0x1b3) [0x66d716]
  ./build/debug/ponyc() [0x66ce8a]
  ./build/debug/ponyc() [0x66d227]
  ./build/debug/ponyc(ast_passes_program+0x28) [0x66d354]
  ./build/debug/ponyc(program_load+0xbf) [0x668fc2]
  ./build/debug/ponyc() [0x649cbd]
  ./build/debug/ponyc(main+0x4cd) [0x64a207]
  /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7fa3fcfb8830]
  ./build/debug/ponyc(_start+0x29) [0x649b09]
Aborted (core dumped)

This same error also occurs if _ is passed as an argument to any function except for a constructor of a class where I get an error that says can't read from '_'.

@Praetonus Praetonus self-assigned this Aug 29, 2017
Praetonus pushed a commit to Praetonus/ponyc that referenced this issue Aug 29, 2017
This change moves a check from the verify pass to the expr pass in
order to catch an illegal read from '_' in a function argument before
trying to use said argument.

Closes ponylang#2157.
jemc pushed a commit that referenced this issue Aug 30, 2017
This change moves a check from the verify pass to the expr pass in
order to catch an illegal read from '_' in a function argument before
trying to use said argument.

Closes #2157.
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

3 participants