www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10942] New: ICE on 1087+ initializers (Internal error: backend\cgcv.c 203)

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

           Summary: ICE on 1087+ initializers (Internal error:
                    backend\cgcv.c 203)
           Product: D
           Version: D2
          Platform: All
        OS/Version: Windows
            Status: NEW
          Keywords: ice
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-09-01
13:41:25 PDT ---
Testing in 2.064 git-head:

-----
import std.string;

string getEnum(size_t count)
{
    string en;
    en ~= "enum KeyCode\n {    \n";

    foreach (i; 0 .. count)
    {
        en ~= format("    memb_%s = %s,\n", i+1, i+1);
    }

    en ~= "} ";
    return en;
}

// Linker warning: Warning 161: Unknown CV version, ignored
// mixin(getEnum(1024));

// ICE  
// mixin(getEnum(1087));

void main() { }
-----

Uncomment the first mixin to start getting linker warnings. Uncomment the
second one instead and an ICE is emitted:

Internal error: backend\cgcv.c 203

I ran into this while translating keycodes from another GUI library. It has
just over 1100 keycodes, and I wanted to put them all in one KeyCode enum.

I can also recreate this with structs and classes, so it's not specific to
enums (e.g. a struct with 1087 'static' fields). The workaround is to make the
keycodes all manifest constants, e.g.:

-----
enum memb_1 = 1;
enum memb_2 = 2;
enum memb_3 = 3;
...
-----

However this does lose me the ability to give the keycodes a single type to
group them under.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 01 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10942



--- Comment #1 from Kenji Hara <k.hara.pg gmail.com> 2013-10-01 19:30:25 PDT ---
To reproduce errors, -g switch is necessary.

 // Linker warning: Warning 161: Unknown CV version, ignored
 // mixin(getEnum(1024));
$ dmd -g -run test DMD v2.064 DEBUG OPTLINK (R) for Win32 Release 8.00.12 Copyright (C) Digital Mars 1989-2010 All rights reserved. http://www.digitalmars.com/ctg/optlink.html test.obj(test) Warning 161: Unknown CV version, ignored
 // ICE  
 // mixin(getEnum(1087));
$ dmd -g -run test DMD v2.064 DEBUG Internal error: backend\cgcv.c 203 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 01 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10942


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com


--- Comment #2 from Walter Bright <bugzilla digitalmars.com> 2013-10-01
22:34:36 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2614

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 01 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10942



--- Comment #3 from github-bugzilla puremagic.com 2013-10-08 21:31:55 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/3f1ae3ce0943678840e6066692b2124d86ba91a3
fix Issue 10942 - ICE on 1087+ initializers (Internal error: backend\cgcv.c
203)

https://github.com/D-Programming-Language/dmd/commit/81249a39dc8953537455ed7d7e6109b721e09c78
Merge pull request #2614 from WalterBright/fix10942

fix Issue 10942 - ICE on 1087+ initializers (Internal error: backend\cgc...

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 08 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10942


Walter Bright <bugzilla digitalmars.com> changed:

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


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 08 2013