Bug 5572 – [64-bit] Global Hidden Mutexes Seem to share Addresses W/ Global Variables

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2011-02-13T18:43:00Z
Last change time
2011-02-13T21:59:53Z
Keywords
wrong-code
Assigned to
nobody
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2011-02-13T18:43:48Z
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.
Comment #1 by bugzilla — 2011-02-13T21:59:53Z