www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20381] New: [REG master 2.089+] compiler crash on array

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

          Issue ID: 20381
           Summary: [REG master 2.089+] compiler crash on array operation
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

The following code crashes

---
void ice(ubyte[1] data)
{
   ubyte[1] and = data[] & [42];
}

void main() {}
---

with


core.exception.AssertError dmd/src/dmd/e2ir.d(2173): Assertion failure
----------------
??:? _d_assertp [0x842141]
dmd/src/dmd/e2ir.d:2176 _ZN6toElem13ToElemVisitor9toElemBinEP6BinExpi
[0x761d42]
dmd/src/dmd/e2ir.d:3473 _ZN6toElem13ToElemVisitor5visitEP6AndExp [0x766c7e]
dmd/src/dmd/expression.d:6220 _ZN6AndExp6acceptEP7Visitor [0x657505]
dmd/src/dmd/e2ir.d:5581 _Z6toElemP10ExpressionP7IRState [0x75e6bd]
dmd/src/dmd/e2ir.d:4189 _ZN6toElem13ToElemVisitor5visitEP7CastExp [0x768d5c]
dmd/src/dmd/expression.d:5152 _ZN7CastExp6acceptEP7Visitor [0x6555b9]
dmd/src/dmd/e2ir.d:5581 _Z6toElemP10ExpressionP7IRState [0x75e6bd]
dmd/src/dmd/e2ir.d:2799 _ZN6toElem13ToElemVisitor5visitEP9AssignExp [0x76436d]
dmd/src/dmd/visitor.d:84 _ZN7Visitor5visitEP12ConstructExp [0x744b2d]
dmd/src/dmd/expression.d:5776 _ZN12ConstructExp6acceptEP7Visitor [0x656985]
dmd/src/dmd/e2ir.d:5581 _Z6toElemP10ExpressionP7IRState [0x75e6bd]
dmd/src/dmd/e2ir.d:5322 _ZN6toElem13ToElemVisitor14Dsymbol_toElemEP7Dsymbol
[0x76be4d]
dmd/src/dmd/e2ir.d:1380 _ZN6toElem13ToElemVisitor5visitEP14DeclarationExp
[0x75f449]
dmd/src/dmd/expression.d:3904 _ZN14DeclarationExp6acceptEP7Visitor [0x6527c9]
dmd/src/dmd/e2ir.d:5581 _Z6toElemP10ExpressionP7IRState [0x75e6bd]
dmd/src/dmd/e2ir.d:5964 _Z10toElemDtorP10ExpressionP7IRState [0x76dae0]
dmd/src/dmd/s2ir.d:755 _ZN11S2irVisitor5visitEP12ExpStatement [0x7562b2]
dmd/src/dmd/statement.d:745 _ZN12ExpStatement6acceptEP7Visitor [0x7145e5]
dmd/src/dmd/s2ir.d:1502 _ZN11S2irVisitor14Statement_toIREP9StatementP7IRState
[0x7582e1]
dmd/src/dmd/s2ir.d:769 _ZN11S2irVisitor5visitEP17CompoundStatement [0x75633b]
dmd/src/dmd/statement.d:937 _ZN17CompoundStatement6acceptEP7Visitor [0x714f01]
dmd/src/dmd/s2ir.d:1521 _Z14Statement_toIRP9StatementP7IRState [0x75839c]
dmd/src/dmd/glue.d:1156 _Z25FuncDeclaration_toObjFileP15FuncDeclarationb
[0x74b82e]
dmd/src/dmd/toobj.d:312 _ZN9toObjFile9ToObjFile5visitEP15FuncDeclaration
[0x7592e8]
dmd/src/dmd/func.d:2504 _ZN15FuncDeclaration6acceptEP7Visitor [0x686581]
dmd/src/dmd/toobj.d:1020 _Z9toObjFileP7Dsymbolb [0x75924e]
dmd/src/dmd/glue.d:392 _Z10genObjFileP6Moduleb [0x749dc7]
dmd/src/dmd/mars.d:681 int dmd.mars.tryMain(ulong, const(char)**, ref
dmd.globals.Param) [0x6ced39]
dmd/src/dmd/mars.d:921 _Dmain [0x6cfc71]             


The crashes doesn't happen if 42 is cast to ubyte or using ubyte(42).


DMD version used: DMD v2.089.0-10-g44cd826a0

--
Nov 10 2019