D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3428 - OSX 10.6.1 Access violation when writing to global variables
Summary: OSX 10.6.1 Access violation when writing to global variables
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86_64 Mac OS X
: P2 blocker
Assignee: No Owner
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2009-10-20 14:40 UTC by Christopher O'Neill
Modified: 2014-04-18 09:12 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Christopher O'Neill 2009-10-20 14:40:22 UTC
DMD v1.050 (using pre-build binary)
gcc version 4.2.1 (Apple Inc. build 5646)
$ ld -v
@(#)PROGRAM:ld  PROJECT:ld64-95.2.12
DMD is creating a Mach-O executable i386

D source:

int q;
void main()
{
	q = 1;   // NB: Access violation occurs on WRITE only
}

Dump of assembler code for function _Dmain:
0x0000287c <_Dmain+0>:	push   %ebp
0x0000287d <_Dmain+1>:	mov    %esp,%ebp
0x0000287f <_Dmain+3>:	call   0x2884 <_Dmain+8>
0x00002884 <_Dmain+8>:	pop    %eax
0x00002885 <_Dmain+9>:	mov    0x1d0d0(%eax),%ecx
0x0000288b <_Dmain+15>:	movl   $0x1,(%ecx)  <-- Access Violation here
0x00002891 <_Dmain+21>:	xor    %eax,%eax
0x00002893 <_Dmain+23>:	pop    %ebp

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00002f10
0x0000288b in _Dmain ()

(gdb) x 0x2f10
0x2f10 <D6object6Object14notifyRegisterMFDFC6ObjectZvZv>:	0x83ec8b55
Comment 1 Sean Kelly 2010-06-07 21:06:37 UTC
Can't reproduce using DMD 2.046.
Comment 2 nfxjfg 2010-06-07 21:18:46 UTC
Sean, shouldn't this be marked as WORKSFORME, then?
Comment 3 Don 2010-06-07 21:24:18 UTC
(In reply to comment #2)
> Sean, shouldn't this be marked as WORKSFORME, then?

If you've ever been able to reproduce the problem, it's FIXED. If not, its WORKSFORME.
Comment 4 Christopher O'Neill 2010-06-08 12:10:21 UTC
The original bug report was filed against DMD1, not DMD2.

However, I can confirm that this bug is indeed fixed in DMD v1.061.