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

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5572 - [64-bit] Global Hidden Mutexes Seem to share Addresses W/ Global Variables
Summary: [64-bit] Global Hidden Mutexes Seem to share Addresses W/ Global Variables
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: wrong-code
Depends on:
Blocks:
Reported: 2011年02月13日 18:43 UTC by David Simcha
Modified: 2011年02月13日 21:59 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description David Simcha 2011年02月13日 18:43:48 UTC
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.


AltStyle によって変換されたページ (->オリジナル) /