May 31, 2023
https://issues.dlang.org/show_bug.cgi?id=23950

          Issue ID: 23950
           Summary: Weird backend fail with noreturn type - cod1.d(4027):
                    Assertion failure
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: mail@ernestocastellotti.it

The DMD backend fails with this code:

import core.stdc.stdlib;

void main() {
    auto foo = false && true || abort();
}

This is the error message:

core.exception.AssertError@src/dmd/backend/cod1.d(4027): Assertion failure
----------------
??:? _d_assertp [0x9884d4]
src/dmd/backend/cod1.d:4027 _Z8funccallR11CodeBuilderP4elemjjPjjb [0x8ffd32]
src/dmd/backend/cod1.d:3749 _Z6cdfuncR11CodeBuilderP4elemPj [0x8fef41]
src/dmd/backend/cgcod.d:2738 _Z7codelemR11CodeBuilderP4elemPjj [0x8f510a]
src/dmd/backend/cod2.d:2082 _Z5cdnotR11CodeBuilderP4elemPj [0x90c4d3]
src/dmd/backend/cgcod.d:2738 _Z7codelemR11CodeBuilderP4elemPjj [0x8f510a]
src/dmd/backend/cgcod.d:2868 _Z8scodelemR11CodeBuilderP4elemPjjb [0x8f555c]
src/dmd/backend/cod4.d:709 _Z4cdeqR11CodeBuilderP4elemPj [0x8bec0b]
src/dmd/backend/cgcod.d:2738 _Z7codelemR11CodeBuilderP4elemPjj [0x8f510a]
src/dmd/backend/cgen.d:198 _Z10gencodelemR11CodeBuilderP4elemPjb [0x940c65]
src/dmd/backend/cod3.d:960
_Z14outblkexitcodeR11CodeBuilderP5blockRiPKcPP6Symbolj [0x917fa3]
src/dmd/backend/cgcod.d:1455 _Z8blcodgenP5block [0x8f2efc]
src/dmd/backend/cgcod.d:291 _Z6codgenP6Symbol [0x8f059d]
src/dmd/backend/dout.d:1034 _Z10writefunc2P6Symbol [0x8a457e]
src/dmd/backend/dout.d:853 _Z9writefuncP6Symbol [0x8a3ed6]
src/dmd/glue.d:1199 _Z25FuncDeclaration_toObjFileP15FuncDeclarationb [0x842a4f]
src/dmd/toobj.d:309 _ZN9toObjFile9ToObjFile5visitEP15FuncDeclaration [0x85c1a1]
src/dmd/func.d:2991 _ZN15FuncDeclaration6acceptEP7Visitor [0x767119]
src/dmd/toobj.d:1021 _Z9toObjFileP7Dsymbolb [0x85c108]
src/dmd/glue.d:529 _Z10genObjFileP6Moduleb [0x840b71]
src/dmd/glue.d:122 void dmd.glue.generateCodeAndWrite(dmd.dmodule.Module[],
const(char)*[], const(char)[], const(char)[], bool, bool, bool, bool, bool)
[0x83f39c]
src/dmd/mars.d:582 int dmd.mars.tryMain(ulong, const(char)**, ref
dmd.globals.Param) [0x64fe08]
src/dmd/mars.d:966 _Dmain [0x651354]

LDC and GDC have no problem with this code so the problem must be related exclusively to the DMD backend, i have no idea what could be causing it someone with backend experience should look into it.

--