Bug 4599 – Error messages with missing memory for array operations
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-08-08T14:29:00Z
Last change time
2015-06-09T05:10:38Z
Keywords
diagnostic
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2010-08-08T14:29:12Z
(I don't know where to file this, so I open a new bug report, sorry if it is a duplicated.)
I'd like DMD 2.047 to catch this bug at compile time (so this is more an enhancement request):
import std.stdio: writeln;
void main() {
double[] a = [1];
writeln(a[] + 1); // access violation
}
----------------
This prints nothing and raises no compile-time or run-time errors (this is more like a bug):
import std.stdio: writeln;
void main() {
int[] a1 = [1, 2];
int[] a2 = [3, 4];
int[] a3;
a3[] = a1[] + a2[];
writeln(a3);
}
Comment #1 by andrej.mitrovich — 2010-08-08T17:54:43Z
Isn't the second one similar to what I've reported in Issue 4521 ?
Comment #2 by bearophile_hugs — 2010-08-08T18:55:32Z
I think it is not, because here you aren't setting the items of a3 to a certain value, you are assigning a certain number of values coming from the vector operation. And there is not enough space for them.
Comment #3 by clugdbug — 2010-08-09T00:05:25Z
The first case is a dup of regression bug 4578, which is fixed in the beta of 2.048.
The second case is a dup of bug 2547.
*** This issue has been marked as a duplicate of issue 2547 ***