www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15817] New: ICE (with no stacktrace) instead of 'cannot index

https://issues.dlang.org/show_bug.cgi?id=15817

          Issue ID: 15817
           Summary: ICE (with no stacktrace) instead of 'cannot index null
                    array counts' with CTFE AA
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: timothee.cour2 gmail.com

dmd -c -o- $bugs_D/bug_D20160320T235820.d

$dmd_067_1_X -c -o- $bugs_D/bug_D20160320T235820.d
Error: cannot index null array counts
called from here: fun("a1.a2 b1.b2")

dmd >= 68: (including DMD64 D Compiler v2.070)
ICE segmentation fault with no stacktrace => very bad!

not sure whether the code should be valid or not, but regardless there
shouldn't be ICE, especially wo stacktrace

----
module bugs.bug_D20160320T235820;
import std.string;
import std.array;

int fun(string b){
  auto targets=b.split.array;
  uint[string]counts;
  foreach(a;targets){
    counts[a]++;
  }
  return 0;
}

void fun2(){
  enum a=`a1.a2 b1.b2`;
  static int b=fun(a);
}
----

--
Mar 21 2016