6250 – [CTFE] Crash when swapping two pointers to arrays.

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6250 - [CTFE] Crash when swapping two pointers to arrays.
Summary: [CTFE] Crash when swapping two pointers to arrays.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 major
Assignee: No Owner
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
Reported: 2011年07月04日 19:36 UTC by yebblies
Modified: 2015年06月09日 05:11 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description yebblies 2011年07月04日 19:36:57 UTC
void swap(int[]* lhs, int[]* rhs)
{
 *lhs = *rhs;
 *rhs = *lhs;
}
int ctfeSort()
{
 int[][2] x;
 swap(&x[0], &x[1]);
 return 0;
}
void main()
{
 enum x = ctfeSort();
}
Causes a stack overflow with dmd master (2.054)
The same thing happens when using references.
void swap(ref int[] lhs, ref int[] rhs)
{
 lhs = rhs;
 rhs = lhs;
}
int ctfeSort()
{
 int[][2] x;
 swap(x[0], x[1]);
 return 0;
}
void main()
{
 enum x = ctfeSort();
}


AltStyle によって変換されたページ (->オリジナル) /