Skip to content

Attempting to partially apply a constructor causes a crash in ponyc #4609

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

Open
chalcolith opened this issue Feb 12, 2025 · 1 comment
Open
Labels
help wanted Extra attention is needed needs investigation This needs to be looked into before its "ready for work"

Comments

@chalcolith
Copy link
Member

The following program (playground link) causes a crash in the compiler:

class A
  let n: USize

  new create(n': USize) =>
    n = n'

actor Main
  new create(env: Env) =>
    let a1 = A(1)
    let ctor = A~create(2)
    let a: A = ctor()

The backtrace is:

/home/gordon/Dev/Pony/ponyc_main/src/libponyc/codegen/genexpr.c:314: gen_assign_cast: Assertion `r_value != GEN_NOTNEEDED` failed.

Backtrace:
  ../../../build/debug/ponyc(ponyint_assert_fail+0x8f) [0x5606be9f621f]
  ../../../build/debug/ponyc(gen_assign_cast+0x5c) [0x5606be91892c]
  ../../../build/debug/ponyc(gen_call+0x678) [0x5606be911808]
  ../../../build/debug/ponyc(gen_expr+0x1b4) [0x5606be918564]
  ../../../build/debug/ponyc(gen_assign+0x47) [0x5606be923777]
  ../../../build/debug/ponyc(gen_expr+0x30d) [0x5606be9186bd]
  ../../../build/debug/ponyc(gen_seq+0x49) [0x5606be9ca479]
  ../../../build/debug/ponyc(gen_expr+0x72) [0x5606be918422]
  ../../../build/debug/ponyc(+0x6eed05) [0x5606be91ad05]
  ../../../build/debug/ponyc(+0x6edfe5) [0x5606be919fe5]
  ../../../build/debug/ponyc(genfun_method_bodies+0x8f) [0x5606be919e5f]
  ../../../build/debug/ponyc(gentypes+0x332) [0x5606be9323f2]
  ../../../build/debug/ponyc(genexe+0x2a6) [0x5606be917ac6]
  ../../../build/debug/ponyc(codegen+0xc9) [0x5606be90cbd9]
  ../../../build/debug/ponyc(generate_passes+0x2c) [0x5606be95ff8c]
  ../../../build/debug/ponyc(+0x6d58cc) [0x5606be9018cc]
  ../../../build/debug/ponyc(main+0x243) [0x5606be901723]
  /lib/x86_64-linux-gnu/libc.so.6(+0x2a1ca) [0x7f75368931ca]
  /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x8b) [0x7f753689328b]
  ../../../build/debug/ponyc(_start+0x25) [0x5606be901415]
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Aborted (core dumped)

Not sure why an LLVM warning is showing up in there, as this is an assert in ponyc code.

@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Feb 12, 2025
@SeanTAllen SeanTAllen added help wanted Extra attention is needed needs investigation This needs to be looked into before its "ready for work" labels Feb 18, 2025
@jemc
Copy link
Member

jemc commented Feb 18, 2025

We discussed in the sync call.

  • The failed assert is basically telling us that the compiler thinks the 2 value is not used, being output as GEN_NOTNEEDED is
  • I tried briefly to find the cause during the call, but didn't find it - will need more investigation.

@SeanTAllen SeanTAllen removed the discuss during sync Should be discussed during an upcoming sync label Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed needs investigation This needs to be looked into before its "ready for work"
Projects
None yet
Development

No branches or pull requests

4 participants