Bug 5534 – [64-bit] Inexplicable segfault in small code snippet, -O -release -m64 only
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2011-02-06T14:23:00Z
Last change time
2011-02-06T22:14:27Z
Assigned to
nobody
Creator
dsimcha
Comments
Comment #0 by dsimcha — 2011-02-06T14:23:46Z
The following code segfaults, but only when compiled with -O -release -m64. If any of these three options are omitted, it succeeds. Also, note that it doesn't throw a RangeError when bounds checking is turned on, so the issue is not that that the bounds are somehow wrong.
void doStuff(byte start, byte end, uint increment = 1U) {
auto output = new byte[3];
size_t count = 0;
for(byte i = start; i < end; i += increment) {
output[count++] = i;
}
}
void main() {
doStuff(0, 3);
}
Comment #1 by bugzilla — 2011-02-06T14:59:22Z
Please mark 64 bit only problems with the "x86_64" platform.