Bug 5571 – [64-bit] new bool returns bogus address

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2011-02-13T16:23:00Z
Last change time
2011-02-13T20:42:26Z
Assigned to
nobody
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2011-02-13T16:23:24Z
import std.stdio; void main() { auto b = new bool; stderr.writeln(b); *b = false; } The address I receive can't be right because it's in "no-man's land" part of x64 address space, at least according to http://en.wikipedia.org/wiki/X86-64 . At any rate, it segfaults the program. AD7DAE8000000000 Segmentation fault
Comment #1 by dsimcha — 2011-02-13T17:02:22Z
Looking into it further, this seems to happen with any primitive type, for example, "new double", "new uint". Amazingly, though, this code works: import std.stdio; void main() { auto b = (new bool[1]).ptr; stderr.writeln(b); *b = 1; }
Comment #2 by bugzilla — 2011-02-13T20:42:26Z