Skip to content

bug: self-referential types crash the VM #2008

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
deelawn opened this issue Apr 30, 2024 · 0 comments · Fixed by #2081
Closed

bug: self-referential types crash the VM #2008

deelawn opened this issue Apr 30, 2024 · 0 comments · Fixed by #2081
Assignees
Labels
🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related

Comments

@deelawn
Copy link
Contributor

deelawn commented Apr 30, 2024

Self-referential types that are prohibited in go can cause the VM to crash. I think we need to check somewhere in the preprocessor that for this. Here is the example to reproduce the issue:

package main

type S struct {
        T S
}

func main() {
        var a, b S
        println(a == b)
}
@deelawn deelawn added 🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related labels Apr 30, 2024
@ltzmaxwell ltzmaxwell self-assigned this May 7, 2024
@Kouteki Kouteki moved this from Triage to In Progress in 🧙‍♂️gno.land core team May 10, 2024
@Kouteki Kouteki added this to the 🏗4️⃣ test4.gno.land milestone May 10, 2024
@zivkovicmilos zivkovicmilos linked a pull request May 15, 2024 that will close this issue
5 tasks
ltzmaxwell added a commit that referenced this issue Aug 16, 2024
Address #2008.


In this pull request, we're implementing a special handling for type
declarations to check cynic dependency. Due to their unique nature, we
must meticulously search through their fields to identify potential
cyclic reference.

<details><summary>Contributors' checklist...</summary>

- [*] Added new tests, or not needed, or not feasible
- [ ] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [ ] Updated the official documentation or not needed
- [*] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [ ] Added references to related issues and PRs
- [ ] Provided any useful hints for running manual tests
- [ ] Added new benchmarks to [generated
graphs](https://gnoland.github.io/benchmarks), if any. More info
[here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
</details>

---------

Co-authored-by: deelawn <dboltz03@gmail.com>
@github-project-automation github-project-automation bot moved this from In Progress to Done in 🧙‍♂️gno.land core team Aug 16, 2024
MikaelVallenet pushed a commit to MikaelVallenet/gno that referenced this issue Aug 17, 2024
)

Address gnolang#2008.


In this pull request, we're implementing a special handling for type
declarations to check cynic dependency. Due to their unique nature, we
must meticulously search through their fields to identify potential
cyclic reference.

<details><summary>Contributors' checklist...</summary>

- [*] Added new tests, or not needed, or not feasible
- [ ] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [ ] Updated the official documentation or not needed
- [*] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [ ] Added references to related issues and PRs
- [ ] Provided any useful hints for running manual tests
- [ ] Added new benchmarks to [generated
graphs](https://gnoland.github.io/benchmarks), if any. More info
[here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
</details>

---------

Co-authored-by: deelawn <dboltz03@gmail.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
🐞 bug Something isn't working 📦 🤖 gnovm Issues or PRs gnovm related
Projects
Development

Successfully merging a pull request may close this issue.

4 participants