Bug 2158 – Static associative array initialisation causes segmentation fault

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2008-06-21T01:22:00Z
Last change time
2015-06-09T01:14:36Z
Keywords
rejects-valid
Assigned to
nobody
Creator
david

Comments

Comment #0 by david — 2008-06-21T01:22:10Z
The following code comiples, but results a segmentation fault. The problem is caused by the initialisation of the associative arrays with array literals. (Initialising the arrays with "null" eliminates the segmentation fault.) -----------------------------8<----------------------------------------- import std.stdint: uint_fast64_t; typedef uint_fast64_t FOO; class A { static invariant FOO fooValue1; static invariant FOO fooValue2; static invariant FOO[string] fooArray; static invariant string[FOO] strArray; static this() { fooValue1 = cast(FOO) 0x8000000000000000LU; fooValue2 = cast(FOO) 0x4000000000000000LU; fooArray = ["s1":fooValue1, "s2":fooValue2]; strArray = [fooValue1:"s1", fooValue2:"s2"]; } }; int main(string[] args) { auto a = new A; return 0; } -----------------------------8<-----------------------------------------
Comment #1 by clugdbug — 2009-10-14T00:08:04Z
This was fixed sometime before DMD2.022