www.digitalmars.com         C & C++   DMDScript  

D - Internal error: ..\ztc\cgcod.c 1402

reply "Dario" <supdar yahoo.com> writes:
The following code causes this compiler output:
Internal error: ..\ztc\cgcod.c 1402

void subdivide()
{
    ColorVertex[] newdata;
    newdata.length = data.length * 4;

    for(uint i; i < data.length; i += 3)
    {
        newdata[i*4 + 0].mean ( data[i + 0] , data[i + 0] );
        newdata[i*4 + 1].mean ( data[i + 0] , data[i + 1] );
        newdata[i*4 + 2].mean ( data[i + 0] , data[i + 2] );

        newdata[i*4 + 3].mean ( data[i + 1] , data[i + 0] );
        newdata[i*4 + 4].mean ( data[i + 1] , data[i + 1] );
        newdata[i*4 + 5].mean ( data[i + 1] , data[i + 2] );

        newdata[i*4 + 6].mean ( data[i + 2] , data[i + 0] );
        newdata[i*4 + 7].mean ( data[i + 2] , data[i + 1] );
        newdata[i*4 + 8].mean ( data[i + 2] , data[i + 2] );

        newdata[i*4 + 9].mean ( data[i + 1] , data[i + 0] );
        newdata[i*4 +10].mean ( data[i + 2] , data[i + 1] );
        newdata[i*4 +11].mean ( data[i + 0] , data[i + 2] );
    }

    data = newdata; // olddata is now garbage
    glInterleavedArrays(GL_C3F_V3F, 0, data);
}

This is a rudimental function that subdivides some triangles (in a external
array) into smaller triangles (four for each one).
void ColorVertex.mean(ColorVertex, ColorVertex) is a method that computes
the color and the coords of the vertex which is between two two arguments.
I've appended the whole source. (GLFW is a OpenGL framework like GLUT).
I apologize if this error had been discussed already.   ='(
    Dario


begin 666 source.d
M:6UP;W)T(&]P96YG;&9W.R O+R!A;B!/<&5N1TP 9G)A;65W;W)K(&QI:V4 
M1TQ55 T*:6UP;W)T(&UA=& [("  (" O+R!022!C;VYS=&%N="!N965D960-
M" T*8V]N<W0 97AT96YD960 4$DR(#T 4$D *B R+C [#0H-"FEN="!R;W1A
M=&4[("\O(&-O;G1A:6YS(&EN9F\ 86)O=70 :&]W('1O(')O=&%T90T*#0IS
M=')U8W0 0V]L;W)697)T97 -"GL)9FQO871;,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D)<R ](&9A;'-E.PT*"6EF*'-0<F5S<V5D
M("8F("%S*0T*"7L)<R ]('1R=64[#0H)"7-U8F1I=FED92 I.PT*"7T-" T*
M"7)E='5R;B A96YD.PT*?0T*#0IV;VED('-U8F1I=FED92 I#0I[#0H)0V]L
M;W)697)T97A;72!N97=D871A.PT*"6YE=V1A=&$N;&5N9W1H(#T 9&%T82YL
M96YG=&  *B T.PT*#0H)9F]R*'5I;G0 :3L :2 \(&1A=&$N;&5N9W1H.R!I
M("L](#,I#0H)>PT*"0ED96)U9R![?2 O+R!I9B!C;VUP:6QE9"!I;B!D96)U
M9R!M;V1E+"!N;R!E<G)O<B!O8V-U<G,-" D)96QS90T*"0E[#0H)"0EN97=D
M871A6VDJ-" K(#!=+FUE86X *"!D871A6VD *R P72 L(&1A=&%;:2 K(#!=
M("D[#0H)"0EN97=D871A6VDJ-" K(#%=+FUE86X *"!D871A6VD *R P72 L
M(&1A=&%;:2 K(#%=("D[#0H)"0EN97=D871A6VDJ-" K(#)=+FUE86X *"!D
M871A6VD *R P72 L(&1A=&%;:2 K(#)=("D[#0H-" D)"6YE=V1A=&%;:2HT
M("L ,UTN;65A;B H(&1A=&%;:2 K(#%=("P 9&%T85MI("L ,%T *3L-" D)
M"6YE=V1A=&%;:2HT("L -%TN;65A;B H(&1A=&%;:2 K(#%=("P 9&%T85MI
M("L ,5T *3L-" D)"6YE=V1A=&%;:2HT("L -5TN;65A;B H(&1A=&%;:2 K
M(#%=("P 9&%T85MI("L ,ET *3L-" T*"0D);F5W9&%T85MI*C0 *R V72YM
M96%N("  9&%T85MI("L ,ET +"!D871A6VD *R P72 I.PT*"0D);F5W9&%T
M85MI*C0 *R W72YM96%N("  9&%T85MI("L ,ET +"!D871A6VD *R Q72 I
M.PT*"0D);F5W9&%T85MI*C0 *R X72YM96%N("  9&%T85MI("L ,ET +"!D
M871A6VD *R R72 I.PT*#0H)"0EN97=D871A6VDJ-" K(#E=+FUE86X *"!D
M871A6VD *R Q72 L(&1A=&%;:2 K(#!=("D[#0H)"0EN97=D871A6VDJ-" K
M,3!=+FUE86X *"!D871A6VD *R R72 L(&1A=&%;:2 K(#%=("D[#0H)"0EN
M97=D871A6VDJ-" K,3%=+FUE86X *"!D871A6VD *R P72 L(&1A=&%;:2 K
M(#)=("D[#0H)"7T-" E]#0H-" ED871A(#T ;F5W9&%T83L +R\ ;VQD(&1A
M=&$ :7, ;F]W(&=A<F)A9V4-" EG;$EN=&5R;&5A=F5D07)R87ES*$=,7T,S
M1E]6,T8L(# L(&1A=&$I.PT*?0T*#0IE>'1E<FXH0RDZ#0H-"G9O:60 <VEZ
M92AI;G0 =VED=& L(&EN="!H96EG:'0I#0I[#0H)9VQ-871R:7A-;V1E*$=,
M7U!23TI%0U1)3TXI.PT*"0EG;$QO861)9&5N=&ET>2 I.PT*#0H)"6EF*&AE
M:6=H=" \(#$I(&AE:6=H=" ](#$[#0H)"6=L5FEE=W!O<G0H,"P ,"P =VED
M=& L(&AE:6=H="D[#0H)"6=L3W)T:&\H+3(N,"P ,BXP+"TR+C L(#(N,"PM
M,BXP+" R+C I.PT*#0H)9VQ-871R:7A-;V1E*$=,7TU/1$5,5DE%5RD[#0I]
M#0H-"G9O:60 ;6]U<V5C;&EC:RAI;G0 8G5T=&]N+"!I;G0 <W1A=&4I#0I[
M#0H):68H8G5T=&]N(#T]($=,1E=?34]54T5?0E545$].7TQ%1E0 *2!I9BAS
M=&%T92D *RMR;W1A=&4[(&5L<V4 +2UR;W1A=&4[#0H):68H8G5T=&]N(#T]
M($=,1E=?34]54T5?0E545$].7U))1TA4*2!I9BAS=&%T92D +2UR;W1A=&4[
2(&5L<V4 *RMR;W1A=&4[#0I]
`
end
Jun 23 2002
parent reply Burton Radons <loth users.sourceforge.net> writes:
Dario wrote:
 The following code causes this compiler output:
 Internal error: ..\ztc\cgcod.c 1402
[snip]
 void ColorVertex.mean(ColorVertex, ColorVertex) is a method that computes
 the color and the coords of the vertex which is between two two arguments.
 I've appended the whole source. (GLFW is a OpenGL framework like GLUT).
 I apologize if this error had been discussed already.   ='(
Passing a struct to a method or function causes this internal error. The only workaround I know of is that if you change ColorVertex.mean to take (ColorVertex *, ColorVertex *) instead; the error should disappear. It sure is a pain, hopefully Walter will be able to patch this bug up fairly soon after he returns.
Jun 23 2002
parent "Dario" <supdar yahoo.com> writes:
 Passing a struct to a method or function causes this internal error.
 The only workaround I know of is that if you change ColorVertex.mean to
 take (ColorVertex *, ColorVertex *) instead; the error should disappear.

 It sure is a pain, hopefully Walter will be able to patch this bug up
 fairly soon after he returns.
Thank you Burton!
Jun 24 2002