www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5572] New: [64-bit] Global Hidden Mutexes Seem to share Addresses W/ Global Variables

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

           Summary: [64-bit] Global Hidden Mutexes Seem to share Addresses
                    W/ Global Variables
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dsimcha yahoo.com



Apparently global gets overwritten when the synchronized block is entered in
the following code:

import std.stdio;

void doSynchronized() {
    stderr.writeln("In doSynchronized() 1:  ", cast(void*) global);
    synchronized {
        stderr.writeln("In doSynchronized() 2:  ", cast(void*) global);
    }
}

__gshared Object global;

void main() {
    auto local = new Object;
    global = local;

    stderr.writeln("In main() 1:  ",
        cast(void*) global, '\t', cast(void*) local);
    doSynchronized();
    stderr.writeln("In main() 2:  ",
        cast(void*) global, '\t', cast(void*) local);

}

Output:

In main() 1:  7F4E605D8E70    7F4E605D8E70
In doSynchronized() 1:  7F4E605D8E70
In doSynchronized() 2:  0
In main() 2:  0    7F4E605D8E70

Happens only in 64-bit mode.  -O, -inline and -release flags seem to be
irrelevant.

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


Walter Bright <bugzilla digitalmars.com> changed:

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



21:59:53 PST ---
https://github.com/D-Programming-Language/dmd/commit/8b008da60a01bb11721943f92dffe2cf38ea1a3d

https://github.com/D-Programming-Language/dmd/commit/2adc2e2e34a625324fe2e45d43e4d7ae84299291

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