[Issue 21957] New: ice when dmd computes the alignment of an union containing a noreturn

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun May 23 03:41:43 UTC 2021


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

          Issue ID: 21957
           Summary: ice when dmd computes the alignment of an union
                    containing a noreturn
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Keywords: accepts-invalid, ice
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: b2.temp at gmx.com

this code causes problem when dmd tries to compute align/side of a type union:

---
alias noreturn = typeof(*null);

union U
{
    noreturn a;
}

int main()
{
    return 0;
}  
---

output:

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.097.0-beta.1-42-g9d718f2f8
predefs   single_module runnable_module run_single_module 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_ModuleInfo
D_Exceptions D_TypeInfo D_HardFloat
binary    /home/basile/dev/repos/dlang/dmd/generated/linux/release/64/dmd
version   v2.097.0-beta.1-42-g9d718f2f8
config    /home/basile/dev/repos/dlang/dmd/generated/linux/release/64/dmd.conf
DFLAGS   
-I/home/basile/dev/repos/dlang/dmd/generated/linux/release/64/../../../../../druntime/import
-I/home/basile/dev/repos/dlang/dmd/generated/linux/release/64/../../../../../phobos
-L-L/home/basile/dev/repos/dlang/dmd/generated/linux/release/64/../../../../../phobos/generated/linux/release/64
-L--export-dynamic -fPIC
---
core.exception.AssertError at src/dmd/aggregate.d(599): Assertion failure
----------------
??:? _d_assertp [0x8e5b55]
src/dmd/aggregate.d:599 pure nothrow @safe void
dmd.aggregate.AggregateDeclaration.alignmember(uint, uint, uint*) [0x5d5e5d]
src/dmd/aggregate.d:638 uint
dmd.aggregate.AggregateDeclaration.placeField(uint*, uint, uint, uint, uint*,
uint*, bool) [0x5d5f82]
src/dmd/declaration.d:1235
_ZN14VarDeclaration14setFieldOffsetEP20AggregateDeclarationPjb [0x6180e2]
src/dmd/dstruct.d:352 _ZN17StructDeclaration12finalizeSizeEv [0x6531d7]
src/dmd/aggregate.d:310 _ZN20AggregateDeclaration13determineSizeE3Loc
[0x5d53b1]
src/dmd/semantic2.d:611 _ZN16Semantic2Visitor5visitEP20AggregateDeclaration
[0x76a61d]
src/dmd/parsetimevisitor.d:88
_ZN16ParseTimeVisitorI10ASTCodegenE5visitEP17StructDeclaration [0x766485]
src/dmd/parsetimevisitor.d:89
_ZN16ParseTimeVisitorI10ASTCodegenE5visitEP16UnionDeclaration [0x7664a9]
src/dmd/dstruct.d:778 _ZN16UnionDeclaration6acceptEP7Visitor [0x654085]
src/dmd/semantic2.d:78 _Z9semantic2P7DsymbolP5Scope [0x76918d]
src/dmd/semantic2.d:339 _ZN16Semantic2Visitor5visitEP6Module [0x769c81]
src/dmd/dmodule.d:1548 _ZN6Module6acceptEP7Visitor [0x63bab9]
src/dmd/semantic2.d:78 _Z9semantic2P7DsymbolP5Scope [0x76918d]
src/dmd/mars.d:495 int dmd.mars.tryMain(ulong, const(char)**, ref
dmd.globals.Param) [0x5c782c]
src/dmd/mars.d:1070 _Dmain [0x5c9869]

--


More information about the Digitalmars-d-bugs mailing list