D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 18057 - [ICE] Segmentation fault (stack overflow) in Expression::ctfeInterpret()
Summary: [ICE] Segmentation fault (stack overflow) in Expression::ctfeInterpret()
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 major
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-10 22:35 UTC by Iain Buclaw
Modified: 2019-01-23 00:02 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Iain Buclaw 2017-12-10 22:35:23 UTC
Minimal test:
---
struct RBNode
{
    RBNode *copy = new RBNode;
}
Comment 1 anonymous4 2017-12-12 10:50:38 UTC
What should happen? CTFE should detect and guard against stack overflow?
Comment 2 Iain Buclaw 2017-12-12 22:09:18 UTC
In this instance, it should detect and guard against stack overflow, because the value of the initializer is indeed recursive.

Consider the following, that would cause a stack overflow at runtime:
---
struct RBNode
{
    RBNode *copy;
    this(int num)
    {
        this.copy = new RBNode(num++);
    }
}
---
Comment 3 github-bugzilla 2018-01-14 20:25:30 UTC
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/265e42a2bf63a89f27878fada44e9eb7892e319b
fix Issue 18057 - [ICE] Segmentation fault (stack overflow) in Expression::ctfeInterpret()

https://github.com/dlang/dmd/commit/74285e41e670bf7e2ae7d83bc9b1617e12f93a65
Merge pull request #7701 from ibuclaw/fix18507

fix Issue 18057 - [ICE] Segmentation fault (stack overflow) in Expression::ctfeInterpret()
merged-on-behalf-of: Sebastian Wilzbach <sebi.wilzbach@gmail.com>
Comment 4 github-bugzilla 2019-01-23 00:02:50 UTC
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/8d6d1ea638e92f85b2af9fb83c2c019e38a0afe3
testsuite: Add another test for issue 18057

https://github.com/dlang/dmd/commit/de0782f642913cabb72bc91cf4d81209f035c6e2
Merge pull request #9285 from ibuclaw/fail18057b

testsuite: Add another test for issue 18057
merged-on-behalf-of: Nicholas Wilson <thewilsonator@users.noreply.github.com>