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 crash when attempting to mutate a val field #4287

Closed
SeanTAllen opened this issue Dec 30, 2022 · 1 comment · Fixed by #4288
Closed

Compiler crash when attempting to mutate a val field #4287

SeanTAllen opened this issue Dec 30, 2022 · 1 comment · Fixed by #4288
Assignees
Labels
bug Something isn't working triggers release Major issue that when fixed, results in an "emergency" release

Comments

@SeanTAllen
Copy link
Member

program:

actor Main
  var niclas:String = "Niclas"
  
  new create(env: Env) =>
    start()
    
  be start() =>
    _start()
    
  fun _start() =>
    niclas = "Hedhman"

backtrace:

* thread #1, name = 'ponyc', stop reason = signal SIGABRT
  * frame #0: 0x00007ffff7d14a7c libc.so.6`pthread_kill + 300
    frame #1: 0x00007ffff7cc0476 libc.so.6`raise + 22
    frame #2: 0x00007ffff7ca67f3 libc.so.6`abort + 211
    frame #3: 0x0000555555c86d9b ponyc`ponyint_assert_fail(expr="0", file="/home/sean/code/ponylang/ponyc/src/libponyc/type/cap.c", line=543, func="cap_fetch") at ponyassert.c:65:3
    frame #4: 0x0000555555c17f1f ponyc`cap_fetch(type=0x00007ffff5a9f240) at cap.c:543:3
    frame #5: 0x0000555555c17f55 ponyc`cap_single(type=0x00007ffff5a9f240) at cap.c:549:16
    frame #6: 0x0000555555c7f065 ponyc`safe_to_mutate(ast=0x00007ffff72d4540) at safeto.c:219:24
    frame #7: 0x0000555555c6f598 ponyc`expr_assign(opt=0x00007fffffffe578, ast=0x00007ffff72d3b00) at operator.c:446:21
    frame #8: 0x0000555555be2fe3 ponyc`pass_expr(astp=0x00007fffffffe060, options=0x00007fffffffe578) at expr.c:576:29
    frame #9: 0x0000555555be3d14 ponyc`ast_visit(ast=0x00007fffffffe060, pre=(ponyc`pass_pre_expr at expr.c:528), post=(ponyc`pass_expr at expr.c:549), options=0x00007fffffffe578, pass=PASS_EXPR) at pass.c:466:12
    frame #10: 0x0000555555be3c54 ponyc`ast_visit(ast=0x00007fffffffe0e0, pre=(ponyc`pass_pre_expr at expr.c:528), post=(ponyc`pass_expr at expr.c:549), options=0x00007fffffffe578, pass=PASS_EXPR) at pass.c:437:14
    frame #11: 0x0000555555be3c54 ponyc`ast_visit(ast=0x00007fffffffe160, pre=(ponyc`pass_pre_expr at expr.c:528), post=(ponyc`pass_expr at expr.c:549), options=0x00007fffffffe578, pass=PASS_EXPR) at pass.c:437:14
    frame #12: 0x0000555555be3c54 ponyc`ast_visit(ast=0x00007fffffffe1e0, pre=(ponyc`pass_pre_expr at expr.c:528), post=(ponyc`pass_expr at expr.c:549), options=0x00007fffffffe578, pass=PASS_EXPR) at pass.c:437:14
    frame #13: 0x0000555555be3c54 ponyc`ast_visit(ast=0x00007fffffffe260, pre=(ponyc`pass_pre_expr at expr.c:528), post=(ponyc`pass_expr at expr.c:549), options=0x00007fffffffe578, pass=PASS_EXPR) at pass.c:437:14
    frame #14: 0x0000555555be3c54 ponyc`ast_visit(ast=0x00007fffffffe2e0, pre=(ponyc`pass_pre_expr at expr.c:528), post=(ponyc`pass_expr at expr.c:549), options=0x00007fffffffe578, pass=PASS_EXPR) at pass.c:437:14
    frame #15: 0x0000555555be3c54 ponyc`ast_visit(ast=0x00007fffffffe360, pre=(ponyc`pass_pre_expr at expr.c:528), post=(ponyc`pass_expr at expr.c:549), options=0x00007fffffffe578, pass=PASS_EXPR) at pass.c:437:14
    frame #16: 0x0000555555be3c54 ponyc`ast_visit(ast=0x00007fffffffe458, pre=(ponyc`pass_pre_expr at expr.c:528), post=(ponyc`pass_expr at expr.c:549), options=0x00007fffffffe578, pass=PASS_EXPR) at pass.c:437:14
    frame #17: 0x0000555555be47d6 ponyc`visit_pass(astp=0x00007fffffffe458, options=0x00007fffffffe578, last_pass=PASS_ALL, out_r=0x00007fffffffe423, pass=PASS_EXPR, pre_fn=(ponyc`pass_pre_expr at expr.c:528), post_fn=(ponyc`pass_expr at expr.c:549)) at pass.c:178:6
    frame #18: 0x0000555555be419a ponyc`ast_passes(astp=0x00007fffffffe458, options=0x00007fffffffe578, last=PASS_ALL) at pass.c:271:7
    frame #19: 0x0000555555be3de2 ponyc`ast_passes_program(ast=0x00007ffff7c3bd00, options=0x00007fffffffe578) at pass.c:327:10
    frame #20: 0x0000555555c06878 ponyc`program_load(path=".", opt=0x00007fffffffe578) at package.c:916:7
@SeanTAllen SeanTAllen added help wanted Extra attention is needed bug Something isn't working needs investigation This needs to be looked into before its "ready for work" labels Dec 30, 2022
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Dec 30, 2022
@SeanTAllen SeanTAllen added the triggers release Major issue that when fixed, results in an "emergency" release label Dec 30, 2022
@SeanTAllen
Copy link
Member Author

So the issue is cap_fetch we only handle TK_NOMINAL and TK_TYPEPARAMREF but we have a TK_ARROW at that point.

@jasoncarr0 this is the code you just added. I'm not sure of the proper fix. Hopefully this is enough triaging to make it an easy fix for you.

@SeanTAllen SeanTAllen changed the title Compiler crash Compiler crash when attempting to mutate a val field Dec 30, 2022
@SeanTAllen SeanTAllen removed needs investigation This needs to be looked into before its "ready for work" help wanted Extra attention is needed labels Dec 30, 2022
@SeanTAllen SeanTAllen self-assigned this Dec 30, 2022
SeanTAllen added a commit that referenced this issue Dec 30, 2022
Fixes a missed case in #4283 (arrow types). Instead of displaying
an error message, the user who was attempting to do an unsafe
mutation of a val was greeted by a compiler crash.

Fixes #4287
SeanTAllen added a commit that referenced this issue Dec 30, 2022
Fixes a missed case in #4283 (arrow types). Instead of displaying
an error message, the user who was attempting to do an unsafe
mutation of a val was greeted by a compiler crash.

Fixes #4287
@ponylang-main ponylang-main removed the discuss during sync Should be discussed during an upcoming sync label Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triggers release Major issue that when fixed, results in an "emergency" release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants