Bug 15961 – [REG2.066] ICE with instance field introduced by anonymous struct

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-04-27T12:28:00Z
Last change time
2017-08-02T08:07:21Z
Keywords
ice, pull, wrong-code
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2016-04-27T12:28:58Z
Test case: struct SliceOverIndexed(T) { enum assignableIndex = T.init; } struct Grapheme { SliceOverIndexed!Grapheme opSlice() { assert(0); } struct { ubyte* ptr_; } } Command line and stack trace of debug build git-master dmd: $ dmd -o- test DMD v2.072.0 DEBUG [email protected](593): Assertion failure ---------------- 0x005ABC47 in _d_assert 0x004038E0 in AggregateDeclaration at c:\d2home\dmd2\src\dmd\src\aggregate.d(594) 0x00403919 in AggregateDeclaration at c:\d2home\dmd2\src\dmd\src\aggregate.d(617) 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 c:\d2home\dmd2\src\dmd\src\aggregate.d(322) 0x0040328C in AggregateDeclaration at c:\d2home\dmd2\src\dmd\src\aggregate.d(343) 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 c:\d2home\dmd2\src\dmd\src\mars.d(1431) 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 function(char[][])*).runAll() 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.
Comment #1 by k.hara.pg — 2016-04-27T12:36:46Z
Comment #2 by github-bugzilla — 2016-04-27T19:15:05Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/4b667bb7603fe1a7b5bb153accf91ebc835c1ce1 fix Issue 15961 - ICE with instance field introduced by anonymous struct `AnonDeclaration.setFieldOffset` may be called before the `semantic` to determine aggregate instance size in early steps. https://github.com/dlang/dmd/commit/0d1d6ffae8be9fdaf63cc02147c91e8ba4e1ad56 Merge pull request #5715 from 9rnsr/fix15961 [REG2.066] Issue 15961 - ICE with instance field introduced by anonymous struct
Comment #3 by github-bugzilla — 2016-04-28T00:55:21Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/4b667bb7603fe1a7b5bb153accf91ebc835c1ce1 fix Issue 15961 - ICE with instance field introduced by anonymous struct https://github.com/dlang/dmd/commit/0d1d6ffae8be9fdaf63cc02147c91e8ba4e1ad56 Merge pull request #5715 from 9rnsr/fix15961
Comment #4 by github-bugzilla — 2017-08-02T08:07:21Z
Commit pushed to dmd-cxx at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/1d76b6fb5958150a404ed193b0aa75ae8064f4c3 Issue 15961 - ICE with instance field introduced by anonymous struct