www.digitalmars.com         C & C++   DMDScript  

c++.beta - [Bug] Internal error: cg87 1618

Hi,

I found a compiler bug. 

the error message is:
Internal error: cg87 1618

the compiler version is 8.46.4n, (the latest beta)
the switchs are -o+all -5 -ff -Ad

the code that trigger the bug is
-----------------------------------------------
#include <stddef.h>

static const void *data = NULL;

class noise
{
int m_seed;
public:
noise()			{m_seed = 0; }

float nf(int n) const
{
n = n ^ m_seed + m_seed;
n = (n << 13) ^ n;
n = n * (n * n * 15731 + 789221) + 1376312589;
return (float)((double)n * (1.0/4294967296.0) + 0.5);
}
};

class bug
{
noise nf;

float i1,i2,i3,i4,i5,i6,i7,i8,i9;
float j1,j2,j3,j4,j5,j6,j7,j8,j9;
float k1,k2,k3,k4,k5,k6,k7,k8,k9;
float l1,l2,l3,l4,l5,l6,l7,l8,l9;


float x1,x2,x3,x4,x5,x6,x7,x8,x9;
float y1,y2,y3,y4,y5,y6,y7,y8,y9;
float z1,z2,z3,z4,z5,z6,z7,z8,z9;
float w1,w2,w3,w4,w5,w6,w7,w8,w9;

public:
void foo(int i);
};

void bug::foo(int i)
{
if(i==0)
return;
else
{
i1 = nf.nf(100) * 2.0f - 1.0f;
i2 = nf.nf(101) * 2.0f - 1.0f;
i3 = nf.nf(102) * 2.0f - 1.0f;
i4 = nf.nf(103) * 2.0f - 1.0f;
i5 = nf.nf(104);
i6 = nf.nf(105) * 2.0f - 1.0f;
i7 = nf.nf(106) * 2.0f - 1.0f;
i8 = nf.nf(107);
i9 = nf.nf(108) * 2.0f - 1.0f;

j1 = nf.nf(110) * 2.0f - 1.0f;
j2 = nf.nf(111) * 2.0f - 1.0f;
j3 = nf.nf(112) * 2.0f - 1.0f;
j4 = nf.nf(113) * 2.0f - 1.0f;
j5 = nf.nf(114);
j6 = nf.nf(115) * 2.0f - 1.0f;
j7 = nf.nf(116) * 2.0f - 1.0f;
j8 = nf.nf(117);
j9 = nf.nf(118) * 2.0f - 1.0f;

k1 = nf.nf(120) * 2.0f - 1.0f;
k2 = nf.nf(121) * 2.0f - 1.0f;
k3 = nf.nf(122) * 2.0f - 1.0f;
k4 = nf.nf(123) * 2.0f - 1.0f;
k5 = nf.nf(124);
k6 = nf.nf(125) * 2.0f - 1.0f;
k7 = nf.nf(126) * 2.0f - 1.0f;
k8 = nf.nf(127);
k9 = nf.nf(128) * 2.0f - 1.0f;

l1 = nf.nf(130) * 2.0f - 1.0f;
l2 = nf.nf(131) * 2.0f - 1.0f;
l3 = nf.nf(132) * 2.0f - 1.0f;
l4 = nf.nf(133) * 2.0f - 1.0f;
l5 = nf.nf(134);
l6 = nf.nf(135) * 2.0f - 1.0f;
l7 = nf.nf(136) * 2.0f - 1.0f;
l8 = nf.nf(137);
l9 = nf.nf(138) * 2.0f - 1.0f;

x1 = nf.nf(700) * 2.0f - 1.0f;
x2 = nf.nf(701) * 2.0f - 1.0f;
x3 = nf.nf(702) * 2.0f - 1.0f;
x4 = nf.nf(703) * 2.0f - 1.0f;
x5 = nf.nf(704);
x6 = nf.nf(705) * 2.0f - 1.0f;
x7 = nf.nf(706) * 2.0f - 1.0f;
x8 = nf.nf(707);
x9 = nf.nf(708) * 2.0f - 1.0f;

y1 = nf.nf(710) * 2.0f - 1.0f;
y2 = nf.nf(711) * 2.0f - 1.0f;
y3 = nf.nf(712) * 2.0f - 1.0f;
y4 = nf.nf(713) * 2.0f - 1.0f;
y5 = nf.nf(714);
y6 = nf.nf(715) * 2.0f - 1.0f;
y7 = nf.nf(716) * 2.0f - 1.0f;
y8 = nf.nf(717);
y9 = nf.nf(718) * 2.0f - 1.0f;

z1 = nf.nf(720) * 2.0f - 1.0f;
z2 = nf.nf(721) * 2.0f - 1.0f;
z3 = nf.nf(722) * 2.0f - 1.0f;
z4 = nf.nf(723) * 2.0f - 1.0f;
z5 = nf.nf(724);
z6 = nf.nf(725) * 2.0f - 1.0f;
z7 = nf.nf(726) * 2.0f - 1.0f;
z8 = nf.nf(727);
z9 = nf.nf(728) * 2.0f - 1.0f;

w1 = nf.nf(730) * 2.0f - 1.0f;
w2 = nf.nf(731) * 2.0f - 1.0f;
w3 = nf.nf(732) * 2.0f - 1.0f;
w4 = nf.nf(733) * 2.0f - 1.0f;
w5 = nf.nf(734);
w6 = nf.nf(735);
w7 = nf.nf(736);
w8 = nf.nf(737);
w9 = nf.nf(738);

if(data == NULL)
data = this;
}
}

int main(int argc, char *argv[])
{
bug b;

b.foo(1);
return 0;
}
-----------------------------------------------

Thanks


Eduardo Nunes
edfpn hotmail.com
Feb 11 2006