www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23008] New: importC: dmd asserts on empty struct or union as

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

          Issue ID: 23008
           Summary: importC: dmd asserts on empty struct or union as
                    global
           Product: D
           Version: D2
          Hardware: All
                OS: Linux
            Status: NEW
          Keywords: ice, ImportC
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: duser neet.fi
                CC: duser neet.fi

struct {} a;
union {} b;

---
ERROR: This is a compiler bug.
Please report it via https://issues.dlang.org/enter_bug.cgi
with, preferably, a reduced, reproducible example and the information below.
DustMite (https://github.com/CyberShadow/DustMite/wiki) can help with the
reduction.
---
DMD v2.099.1-339-g863fec775
predefs   DigitalMars LittleEndian D_Version2 all D_SIMD Posix ELFv1 linux
CRuntime_Glibc CppRuntime_Gcc D_InlineAsm_X86_64 X86_64 D_LP64 D_PIC assert
D_PreConditions D_PostConditions D_Invariants D_ModuleInfo D_Exceptions
D_TypeInfo D_HardFloat
binary    /home/human/work/result/bin/dmd
version   v2.099.1-339-g863fec775
config    /home/human/work/result/bin/dmd.conf
DFLAGS    -I/home/human/work/result/bin/../import
-L-L/home/human/work/result/bin/../lib -L--export-dynamic -fPIC
---
core.exception.AssertError src/dmd/toobj.d(613): Assertion failure
----------------
??:? onAssertError [0x7fcc94168622]
src/dmd/toobj.d:613 _ZN9toObjFile9ToObjFile5visitEP14VarDeclaration
[0x55e7ad4e0af6]
src/dmd/declaration.d:1653 _ZN14VarDeclaration6acceptEP7Visitor
[0x55e7ad2a9bdb]
src/dmd/toobj.d:748 _ZN9toObjFile9ToObjFile5visitEP17AttribDeclaration
[0x55e7ad4e0531]
??:? _ZN16ParseTimeVisitorI10ASTCodegenE5visitEP15LinkDeclaration
[0x55e7ad4f14e5]
src/dmd/attrib.d:434 _ZN15LinkDeclaration6acceptEP7Visitor [0x55e7ad2aa15b]
src/dmd/toobj.d:1008 _Z9toObjFileP7Dsymbolb [0x55e7ad2d3831]
src/dmd/glue.d:522 _Z10genObjFileP6Moduleb [0x55e7ad4c64a2]
src/dmd/glue.d:137 void dmd.glue.generateCodeAndWrite(dmd.dmodule.Module[],
const(char)*[], const(char)[], const(char)[], bool, bool, bool, bool, bool)
[0x55e7ad2e1d58]
src/dmd/mars.d:574 int dmd.mars.tryMain(ulong, const(char)**, ref
dmd.globals.Param) [0x55e7ad2e462b]
src/dmd/mars.d:958 _Dmain [0x55e7ad2effcf]
---

line at current commit:
https://github.com/dlang/dmd/blob/863fec775e2dd8b8f4788849d7b8923b70dcf279/src/dmd/toobj.d#L613

--
Apr 10 2022