D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7908 - Array operations fail when compiled with -d flag
Summary: Array operations fail when compiled with -d flag
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 major
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-14 06:17 UTC by Eldar Insafutdinov
Modified: 2020-05-24 08:21 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Eldar Insafutdinov 2012-04-14 06:17:55 UTC
The following snippet fails when compiled with -d flag.

---
void main()
{
    alias int* IntPtr;
    auto values = new IntPtr[3];
    for(int i = 0; i < values.length; ++i)
        values[i] = new int;
    auto copies = new IntPtr[values.length];
    copies[] = values;
    assert(values[1] == copies[1]);
}
---

As a result of the array operation the elements of "copies" are in fact equal to each other.
Comment 1 Eldar Insafutdinov 2012-04-14 11:57:55 UTC
Something I forgot to add that it's a front end bug, because exactly the same is happening with ldc.
Comment 2 SomeDude 2012-04-21 11:54:37 UTC
Also fails on DMD 2.059 Win32
Comment 3 basile-z 2020-05-24 08:21:39 UTC
fixed since v2.063 according to run.dlang.io