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




M;VQO<E9E<G1E>"!R*0T*"7L-" D)9F]R*'5I;G0 :3L :2 \(&-O;&]R+FQE
M;F=T:#L *RMI*0T*"0D)=&AI<RYC;VQO<EMI72 ]("AL+F-O;&]R6VE=("L 
M<BYC;VQO<EMI72D +R R.PT*"0EF;W(H=6EN="!I.R!I(#P =F5R=&5X+FQE
M;F=T:#L *RMI*0T*"0D)=&AI<RYV97)T97A;:5T /2 H;"YV97)T97A;:5T 
M*R!R+G9E<G1E>%MI72D +R R.PT*"7T-"GT-" T*0V]L;W)697)T97A;72!D
M871A(#T (" O+R!L:7-T(&]F('9E<G1I8V5S('1O(&)E(&1I<W!L87EE9 T*



M,"PM,"XU-S<S-2PM,2XQ-30W,%T ?2P-" T*"7L 6S$N,"P ,"XP+" P+C!=












M*2!R971U<FX ,3L-" T*"6]K(#T 9VQF=T]P96Y7:6YD;W<-" DH"38P,"P 
M-C P+ T*"0DX+" X+" X+" X+ T*"0DS,BP ,"P-" D)1TQ&5U]724Y$3U<-
M" DI.PT*"6EF*"%O:RD 9V]T;R!E<G)O<CL-" T*"6]K(#T :6YI=" I.PT*
M"6EF*"%O:RD 9V]T;R!E<G)O<CL-" T*("!W:&EL92  8V]N=')O;" I("D-
M"B  >PT*"6]K(#T 9')A=R I.PT*"6EF*"%O:RD 9V]T;R!E<G)O<CL-" T*







M:$9U;F,H1TQ?3$5154%,*3L-" T*"2\O('-E="!U<"!V97)T97  9&%T82!S


M*"D-"GL-" EG;$-L96%R*$=,7T-/3$]27T)51D9%4E]"250 ?"!'3%]$15!4
M2%]"549&15)?0DE4*3L-" T*"7-T871I8R!F;&]A="!O;&14:6UE(#T ,"XP


M871E(#P ," _("UY<F]T(#H


M(&1A=&$N;&5N9W1H*3L-" T*"7)E='5R;B A9VQ'971%<G)O<B I.PT*?0T*

M1V5T5VEN9&]W4&%R86TH1TQ&5U]/4$5.140I.PT*"65N9"!\/2!G;&9W1V5T

M+"!S=6)D:79I9&4 96%C:"!T<FEA;F=L93H-" DO+R!T:&4 <F5S=6QT('-H

M(&)I="!S.PT*"6)I="!S4')E<W-E9" ](&=L9G='971+97DH)U,G*3L-" EI
M9B A<U!R97-S960 )B8 <RD-" D)<R ](&9A;'-E.PT*"6EF*'-0<F5S<V5D


M;W)697)T97A;72!N97=D871A.PT*"6YE=V1A=&$N;&5N9W1H(#T 9&%T82YL









M("L ,5T *3L-" D)"6YE=V1A=&%;:2HT("L -5TN;65A;B H(&1A=&%;:2 K

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



M97=D871A6VDJ-" K,3%=+FUE86X *"!D871A6VD *R P72 L(&1A=&%;:2 K

M=&$ :7, ;F]W(&=A<F)A9V4-" EG;$EN=&5R;&5A=F5D07)R87ES*$=,7T,S









M($=,1E=?34]54T5?0E545$].7U))1TA4*2!I9BAS=&%T92D +2UR;W1A=&4[

`
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