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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 13 18:46:18 PST 2011


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 at puremagic.com
        ReportedBy: dsimcha at yahoo.com


--- Comment #0 from David Simcha <dsimcha at yahoo.com> 2011-02-13 18:43:48 PST ---
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: -------


More information about the Digitalmars-d-bugs mailing list