www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11849] New: Recursive enum causes segfault

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11849

           Summary: Recursive enum causes segfault
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: doob me.com


--- Comment #0 from Jacob Carlborg <doob me.com> 2013-12-30 15:34:26 PST ---
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
}

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 30 2013
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11849


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2014-01-03 06:47:29 PST ---
https://github.com/D-Programming-Language/dmd/pull/3057

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 03 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11849



--- Comment #2 from Jacob Carlborg <doob me.com> 2014-01-03 06:51:15 PST ---
(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. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 03 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11849



--- Comment #3 from Kenji Hara <k.hara.pg gmail.com> 2014-01-03 07:05:13 PST ---
(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. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 03 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11849



--- Comment #4 from Jacob Carlborg <doob me.com> 2014-01-03 07:09:23 PST ---
(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. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 03 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11849



--- Comment #5 from Kenji Hara <k.hara.pg gmail.com> 2014-01-04 22:30:21 PST ---
(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. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 04 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11849



--- Comment #6 from github-bugzilla puremagic.com 2014-01-05 00:11:27 PST ---
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

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 05 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11849


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 05 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11849



--- Comment #7 from Jacob Carlborg <doob me.com> 2014-01-05 01:21:32 PST ---
Thanks.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 05 2014
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11849


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |regression


--- Comment #8 from Kenji Hara <k.hara.pg gmail.com> 2014-01-07 02:26:24 PST ---
(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. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 07 2014
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11849



--- Comment #9 from github-bugzilla puremagic.com 2014-01-07 02:33:00 PST ---
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

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 07 2014