Thread overview
[Issue 1697] New: Internal Compiler error 2322
Nov 28, 2007
d-bugmail
[Issue 1697] Internal error: ..\ztc\cgcod.c 2322 with -O
Nov 28, 2007
d-bugmail
Jan 21, 2008
d-bugmail
November 28, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1697

           Summary: Internal Compiler error  2322
           Product: D
           Version: 1.023
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: dick221z@yahoo.com


compiling the following with the switches "-O -inline -release" gives an Internal error: ..\ztc\cgcod.c 2322

The error goes away if the -O switch is not used.
The problem 1st showed up in 1.023 and is also in 1.024.
Removing any line of code in this example will make the error go away.

-------------------------------------
import std.utf;
class foo1
{
        this(){}
        void method1( char [] name ){}
        void method2( int i, char [] name){}
}

struct foo
{
        char [] Name;
}


class someclass
{

    foo1 FooClass;
    foo FooStruct;

    private:

    void func()
    {

        wchar [][] theNames;

        FooClass.method2(-1, FooStruct.Name);
        FooClass.method2(-1, FooStruct.Name);

        foreach( Name; theNames )
        {
            auto char [] thename  = toUTF8(Name);

            if( thename[0..3] == "123" )
                FooClass.method1(thename);

            if( thename[0..3] == "345" || thename[0..3] == "765" )
                FooClass.method1(thename);
        }

        FooClass.method2(-1, FooStruct.Name);

    }

    public:
        this(){FooClass = new foo1;}

}


-- 

November 28, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1697


matti.niemenmaa+dbugzilla@iki.fi changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |major
           Keywords|                            |ice-on-valid-code
            Summary|Internal Compiler error     |Internal error:
                   |2322                        |..\ztc\cgcod.c 2322 with -O




------- Comment #1 from matti.niemenmaa+dbugzilla@iki.fi  2007-11-28 11:18 -------
> Removing any line of code in this example will make the error go away.

Simpler version follows. Sorry, I had to act on this statement. :-)

----
void f(int n) {}
void g(char[] s) {}

char[][] a;

class bar {
        int i;

        void func() {
                f(i);

                foreach (s; a) {
                        if (s == s){}
                        if (s[0..0] == "" && s[0..0])
                                g(s);
                }

                f(i);
        }
}
----


-- 

January 21, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1697


matti.niemenmaa+dbugzilla@iki.fi changed:

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




------- Comment #2 from matti.niemenmaa+dbugzilla@iki.fi  2008-01-21 02:51 -------
Fixed in 1.026.


--