Bug 11849 – Recursive enum causes segfault

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-12-30T15:34:00Z
Last change time
2014-01-07T02:33:00Z
Keywords
ice, pull
Assigned to
nobody
Creator
doob

Comments

Comment #0 by doob — 2013-12-30T15:34:26Z
The following code causes a segmentation fault when compiled with DMD git HEAD: alias DWORD = uint; enum : DWORD { REG_DWORD = 4 } enum RegValueType : DWORD { Unknown = DWORD.max, DWORD = REG_DWORD } Seems to be an infinite loop. I don't know if it's the same problem but this code causes a segmentation fault as well: enum : DWORD { DWORD = REG_DWORD }
Comment #1 by k.hara.pg — 2014-01-03T06:47:29Z
Comment #2 by doob — 2014-01-03T06:51:15Z
(In reply to comment #1) > https://github.com/D-Programming-Language/dmd/pull/3057 Does that pull request handle the second case: enum : DWORD { DWORD = REG_DWORD } I don't see an explicit test for that case.
Comment #3 by k.hara.pg — 2014-01-03T07:05:13Z
(In reply to comment #2) > (In reply to comment #1) > > https://github.com/D-Programming-Language/dmd/pull/3057 > > Does that pull request handle the second case: > > enum : DWORD > { > DWORD = REG_DWORD > } > > I don't see an explicit test for that case. Do you mean this full test case? module test; alias DWORD = uint; // L3 first definition of 'test.DWORD' enum : DWORD { REG_DWORD = 4 } enum : DWORD { DWORD = REG_DWORD // L12 second definition of 'test.DWORD' } Output: test.d(12): Error: enum member test.DWORD conflicts with alias test.DWORD at test.d(3) There's no "recursive" definition, so that's not directly related to the reported segfault issue.
Comment #4 by doob — 2014-01-03T07:09:23Z
(In reply to comment #3) > Do you mean this full test case? No, I mean only exact this code: enum : DWORD { DWORD = REG_DWORD } This is without having declared "DWORD" or "REG_DWORD" previously. That will cause a segmentation fault as well. Seems to be an infinite loop there as well.
Comment #5 by k.hara.pg — 2014-01-04T22:30:21Z
(In reply to comment #4) > (In reply to comment #3) > > > Do you mean this full test case? > > No, I mean only exact this code: > > enum : DWORD > { > DWORD = REG_DWORD > } > > This is without having declared "DWORD" or "REG_DWORD" previously. That will > cause a segmentation fault as well. Seems to be an infinite loop there as well. OK, I updated PR to fix the ICE.
Comment #6 by github-bugzilla — 2014-01-05T00:11:27Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/1cb5407fdf29c57511e048e332840d0bf45b529c fix Issue 11849 - Recursive enum causes segfault https://github.com/D-Programming-Language/dmd/commit/80da22ed3e800755a53fc54bcc938627d4611fc6 Merge pull request #3057 from 9rnsr/fix11849 Issue 11849 - Recursive enum causes segfault
Comment #7 by doob — 2014-01-05T01:21:32Z
Thanks.
Comment #8 by k.hara.pg — 2014-01-07T02:26:24Z
(In reply to comment #0) > alias DWORD = uint; > > enum : DWORD > { > REG_DWORD = 4 > } > > enum RegValueType : DWORD > { > Unknown = DWORD.max, > DWORD = REG_DWORD > } This code meaning was changed from 2.064, but infinite loop did not occur with 2.063.
Comment #9 by github-bugzilla — 2014-01-07T02:33:00Z
Commit pushed to 2.065 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/0895bed3880b2f925e30cc53727d6cfd533a4c8c Merge pull request #3057 from 9rnsr/fix11849 Issue 11849 - Recursive enum causes segfault