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

Consume on LHS of assignment causes segfault #3463

Closed
ivanbakel opened this issue Feb 5, 2020 · 2 comments · Fixed by #3650
Closed

Consume on LHS of assignment causes segfault #3463

ivanbakel opened this issue Feb 5, 2020 · 2 comments · Fixed by #3650
Labels
help wanted Extra attention is needed

Comments

@ivanbakel
Copy link

I was experimenting with how Pony handles paths on the LHS of an assignment which have side-effects, and I managed to trip over this compiler bug.

System

Linux 5.4.2-gnu-1 #1 SMP PREEMPT Fri, 06 Dec 2019 00:53:00 +0000 unknown GNU/Linux

The distribution is Parabola, a free Arch variant. Unless packages contain non-free software, they are normally sourced directly from Archlinux instead of being repackaged.

Compiler version

0.33.1 [release]
compiled with: llvm 7.1.0 -- cc (GCC) 9.2.0
Defaults: pic=true

Minimal Example

actor Main
  new create(env: Env val) =>
    let f : Foo iso = recover Foo end

    (consume f).b = recover Bar end

class Foo
  var b: Bar iso

  new create() =>
    b = recover Bar end

class Bar
  new create() => None

Expected Result

There's nothing inherently wrong with the code as written, I think - so it should compile, even if it is a bit nonsensical and people should be discouraged from writing it in production.

Compiler Output

Building builtin -> /usr/lib/pony/0.33.1/packages/builtin
Building . -> ...
src/libponyc/pass/refer.c:135: generate_multi_dot_name: Assertion `0` failed.

Backtrace:
   ...
Aborted (core dumped)
@mfelsche
Copy link
Contributor

mfelsche commented Feb 5, 2020

Thanks for the detailed report. I think this is the same assertion as is being hit in #3453.

@SeanTAllen SeanTAllen added help wanted Extra attention is needed bug and removed duplicate labels May 12, 2020
@SeanTAllen
Copy link
Member

@kapilash has a PR that fixes #3453. It does not however fix this. So this is probably not the same issue (although it might be similar).

kapilash added a commit to kapilash/ponyc that referenced this issue Sep 11, 2020
* `consume (consume variable).field` must result in similar compiation error as
* `consume (consume variable)`.
* `consume f().field` must result in similar compilation error as `consume
f()`
* `(consume f).b` must be treated as `consume f.b`

Fixes ponylang#3463, ponylang#3567 (and ponylang#3453)
kapilash added a commit to kapilash/ponyc that referenced this issue Sep 12, 2020
* `consume (consume variable).field` must result in a similar compillation error as
     `consume (consume variable)`.
* `consume f().field` must result in similar compilation error as `consume
f()`
* `(consume f).b` must be allowed and `f` should be moved.

Fixes ponylang#3463, ponylang#3567 (and ponylang#3453)
SeanTAllen pushed a commit that referenced this issue Sep 15, 2020
* `consume (consume variable).field` must result in a similar compillation error as
     `consume (consume variable)`.
* `consume f().field` must result in similar compilation error as `consume
f()`
* `(consume f).b` must be allowed and `f` should be moved.

Fixes #3463 
Fixes #3567 
Fixes #3453
@SeanTAllen SeanTAllen removed the bug label Jan 22, 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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants