www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15961] New: [REG-master] ICE with instance field introduced


          Issue ID: 15961
           Summary: [REG-master] ICE with instance field introduced by
                    anonymous struct
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ice, wrong-code
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: k.hara.pg gmail.com

Test case:

struct SliceOverIndexed(T)
    enum assignableIndex = T.init;

struct Grapheme
    SliceOverIndexed!Grapheme opSlice()

        ubyte* ptr_;

Command line and stack trace of debug build git-master dmd:

$ dmd -o- test
DMD v2.072.0 DEBUG
core.exception.AssertError aggregate.d(593): Assertion failure
0x005ABC47 in _d_assert
0x004038E0 in AggregateDeclaration at
0x00403919 in AggregateDeclaration at
0x00407D40 in AnonDeclaration at c:\d2home\dmd2\src\dmd\src\attrib.d(744)
0x0044DD0C in StructDeclaration at c:\d2home\dmd2\src\dmd\src\dstruct.d(566)
0x0040320A in AggregateDeclaration at
0x0040328C in AggregateDeclaration at
0x004BFC1E in TypeStruct at c:\d2home\dmd2\src\dmd\src\mtype.d(8051)
0x004B5229 in Type at c:\d2home\dmd2\src\dmd\src\mtype.d(2421)
0x004B5659 in Type at c:\d2home\dmd2\src\dmd\src\mtype.d(2532)
0x004B598D in Type at c:\d2home\dmd2\src\dmd\src\mtype.d(2628)
0x004BF321 in TypeStruct at c:\d2home\dmd2\src\dmd\src\mtype.d(7875)
0x00475110 in DotIdExp at c:\d2home\dmd2\src\dmd\src\expression.d(8825)
0x00473F90 in DotIdExp at c:\d2home\dmd2\src\dmd\src\expression.d(8445)
0x0049FD50 in ExpInitializer at c:\d2home\dmd2\src\dmd\src\init.d(775)
0x0042A8C0 in VarDeclaration at c:\d2home\dmd2\src\dmd\src\declaration.d(1091)
0x0044D6AD in StructDeclaration at c:\d2home\dmd2\src\dmd\src\dstruct.d(374)
0x0045FF05 in TemplateInstance at c:\d2home\dmd2\src\dmd\src\dtemplate.d(8205)
0x0045FF5C in TemplateInstance at c:\d2home\dmd2\src\dmd\src\dtemplate.d(8223)
0x0045C774 in TemplateInstance at c:\d2home\dmd2\src\dmd\src\dtemplate.d(6309)
0x0045CD9F in TemplateInstance at c:\d2home\dmd2\src\dmd\src\dtemplate.d(6539)
0x004BE5A9 in TypeInstance at c:\d2home\dmd2\src\dmd\src\mtype.d(7406)
0x004BE656 in TypeInstance at c:\d2home\dmd2\src\dmd\src\mtype.d(7428)
0x004BB41C in TypeFunction at c:\d2home\dmd2\src\dmd\src\mtype.d(5876)
0x004873BA in FuncDeclaration at c:\d2home\dmd2\src\dmd\src\func.d(725)
0x0044D6AD in StructDeclaration at c:\d2home\dmd2\src\dmd\src\dstruct.d(374)
0x00445A5B in Module at c:\d2home\dmd2\src\dmd\src\dmodule.d(994)
0x004B07C3 in int ddmd.mars.tryMain(uint, const(char)**) at
0x004B11D3 in _Dmain at c:\d2home\dmd2\src\dmd\src\mars.d(1655)
0x005AD9A2 in D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv
0x005AD977 in void rt.dmain2._d_run_main(int, char**, extern (C) int
0x005AD88B in _d_run_main
0x004B170C in main
0x005C1F4D in mainCRTStartup
0x7605338A in BaseThreadInitThunk
0x77AC9A02 in RtlInitializeExceptionChain
0x77AC99D5 in RtlInitializeExceptionChain

This is a regression from 2.066. Since 2.066 to 2.068, the code had displayed
an assertion failure:

Assertion failure: 'alignment > 0 && !(alignment & (alignment - 1))' on line
455 in file 'struct.c'

abnormal program termination

But from 2.069, dmd codebase was switched to D, then the assertion failure no
longer happen with released dmd, and I guess it would have been wrong code bug
because of incorrect alignment.

Apr 27 2016