www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2158] New: Static associative array initialisation causes segmentation fault

reply d-bugmail puremagic.com writes:

           Summary: Static associative array initialisation causes
                    segmentation fault
           Product: D
           Version: 2.012
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: david ferenczi.net

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.)

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;

Jun 20 2008
parent d-bugmail puremagic.com writes:

Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |FIXED

--- Comment #1 from Don <clugdbug yahoo.com.au> 2009-10-14 00:08:04 PDT ---
This was fixed sometime before DMD2.022

Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 14 2009