www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5571] New: [64-bit] new bool returns bogus address

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5571

           Summary: [64-bit] new bool returns bogus address
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dsimcha yahoo.com



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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 13 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5571




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;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 13 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5571


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED



20:42:26 PST ---
https://github.com/D-Programming-Language/dmd/commit/17a2a204f41039029f2e29ec33a8e66197557540

https://github.com/D-Programming-Language/dmd/commit/15005056cf21090c3572a81e8a3db492e7b923d8

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 13 2011