[Issue 21794] New: Internal compiler assertion

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 3 21:38:32 UTC 2021


          Issue ID: 21794
           Summary: Internal compiler assertion
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/
                OS: All
            Status: NEW
          Severity: major
          Priority: P3
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: eyal at weka.io

This program triggers an internal compiler assertion (when assertions are
enabled in dmd itself):

  void f(void* p) {
      const x = cast(ulong)p;

  pragma(msg, f(null));

Specifically, the assignment goes thru:

  private void setValue(VarDeclaration vd, Expression newval) {
    assert((vd.storage_class & (STC.out_ | STC.ref_)) ?
isCtfeReferenceValid(newval) : isCtfeValueValid(newval));

and isCtfeValueValid has:

        case TOK.null_:
            return tb.ty == Tnull    ||
                   tb.ty == Tpointer ||
                   tb.ty == Tarray   ||
                   tb.ty == Taarray  ||
                   tb.ty == Tclass   ||
                   tb.ty == Tdelegate;

which returns false, because tb.ty is Tuns64.


More information about the Digitalmars-d-bugs mailing list