D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7380 - Crash trying to use address of variable in struct constructor at module level
Summary: Crash trying to use address of variable in struct constructor at module level
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: ice
Depends on:
Blocks:
 
Reported: 2012-01-27 11:22 UTC by Stewart Gordon
Modified: 2012-04-02 01:20 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Stewart Gordon 2012-01-27 11:22:22 UTC
DMD 2.057, Windows Vista 32-bit
----------
struct TestStruct {
	this(int* d) {}
}

int xm;
auto tsm = TestStruct(&xm);
----------
C:\Users\Stewart\Documents\Programming\D\Tests\bugs>dmd inout_ctor_bug.d
inout_ctor_bug.d(6): Error: static variable xm cannot be read at compile time
----------
Problem signature:
  Problem Event Name:	APPCRASH
  Application Name:	dmd.exe
  Application Version:	0.0.0.0
  Application Timestamp:	00000000
  Fault Module Name:	dmd.exe
  Fault Module Version:	0.0.0.0
  Fault Module Timestamp:	00000000
  Exception Code:	c0000005
  Exception Offset:	0007e672
  OS Version:	6.0.6002.2.2.0.768.3
  Locale ID:	2057
  Additional Information 1:	482b
  Additional Information 2:	fe3cbbb77b564d5f0cb2cc6fc75b3c2f
  Additional Information 3:	73f1
  Additional Information 4:	1e2657c1444006182528bd2953dbb394
----------

The error message the compiler actually emits seems correct, but the crash certainly isn't.
Comment 1 github-bugzilla 2012-03-30 18:44:00 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/648777b74259462eaa402b657411f2bd5950c9b0
Fix issue 7380 Crash trying to use address of variable in struct constructor
at module level

https://github.com/D-Programming-Language/dmd/commit/7536fd03d1326cbf5c327cce87f398dfbd46368d
Merge pull request #853 from donc/segfault7380

Fix issue 7380 segfault trying to use address of global variable in CTFE