www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19413] New: Segfault assigning hashmap from slice in CTFE


          Issue ID: 19413
           Summary: Segfault assigning hashmap from slice in CTFE
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dlang ryanjframe.com

Tested on Windows DMD 2081.2 and 2083.0
On Linux 2.065.0 and 2082.0

Compiler segfaults when assigning from a slice to an AA that contains another
array in CTFE.

Does not occur if executed at runtime or with a string[string].

void main() { enum a = d(); }

auto d() {
    alias VP = string[string];
    VP[string] values;
    string str = "aaaaaa";
    values[str]["s"] = "val";

    str = str[1..3];
    values[str]["s"] = "val"; // <-- right here.

    return values;
DMD v2.083.0

predefs   Have_new DigitalMars Windows CRuntime_DigitalMars
CppRuntime_DigitalMars LittleEndian D_Version2 all D_InlineAsm D_InlineAsm_X86
X86 Win32 assert D_ModuleInfo D_Exceptions D_TypeInfo D_HardFloat
binary    C:\D\dmd2\windows\bin\dmd.exe
version   v2.083.0

config    C:\D\dmd2\windows\bin\sc.ini
DFLAGS    -IC:\D\dmd2\windows\bin\..\..\src\phobos

Nov 19 2018