digitalmars.D.learn - Is this a bug?
- Caligo <iteronvexor gmail.com> Sep 12 2011
--20cf307abe49bfc8ef04acca47df
Content-Type: text/plain; charset=ISO-8859-1
Trying to help someone on SO, I ran into problems.
On a 64-bit Linux machine, with DMD 2.055
This gives: '/Internal error: ../ztc/cg87.c 202'
void main(){
auto f = (double m){ static double sum = 0.0; return sum += m * m; };
double[] a = array(map!f(iota(1.0, 25.0, 1.0)));
writeln(a);
}
This one compiles but I get Segmentation fault.
void main(){
auto f = (double m){ /* static double sum = 0.0;*/ return m * m; };
double[] a = array(map!f(iota(1.0, 25.0, 1.0)));
writeln(a);
}
This one compiles and runs.
void main(){
auto f = (double m){ /* static double sum = 0.0;*/ return m * m; };
double[] a = array(map!f(array(iota(1.0, 25.0, 1.0))));
writeln(a);
//works
}
Putting everything together, I still get 'Internal error: ../ztc/cg87.c 202'
with this one.
void main(){
auto f = (double m){ static double sum = 0.0; return sum += m * m; };
double[] a = array(map!f(array(iota(1.0, 25.0, 1.0))));
writeln(a);
}
--20cf307abe49bfc8ef04acca47df
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Trying to help someone on SO, I ran into problems.<br><br>On a 64-bit Linux=
machine, with DMD 2.055<br><br>This gives:=A0 '/Internal error: ../ztc=
/cg87.c 202'<br>void main(){<br><br>=A0 auto f =3D (double m){ static d=
ouble sum =3D 0.0; return sum +=3D m * m; };<br>
=A0 double[] a =3D array(map!f(iota(1.0, 25.0, 1.0)));<br>=A0 writeln(a);<b=
r>}<br><br><br>This one compiles but I get Segmentation fault.<br>void main=
(){<br><br>=A0=A0 auto f =3D (double m){ /* static double sum =3D 0.0;*/ re=
turn m * m; };<br>
=A0=A0 double[] a =3D array(map!f(iota(1.0, 25.0, 1.0)));<br>=A0=A0 writeln=
(a);<br>=A0}<br><br><br>This one compiles and runs.<br>=A0void main(){<br><=
br>=A0=A0 auto f =3D (double m){ /* static double sum =3D 0.0;*/ return m *=
m; };<br>=A0=A0 double[] a =3D array(map!f(array(iota(1.0, 25.0, 1.0))));<=
br>
=A0=A0 writeln(a);<br>=A0=A0 //works<br>=A0}<br><br><br>Putting everything =
together, I still get 'Internal error: ../ztc/cg87.c 202' with this=
one.<br>void main(){<br><br>=A0 auto f =3D (double m){ static double sum =
=3D 0.0; return sum +=3D m * m; };<br>
=A0 double[] a =3D array(map!f(array(iota(1.0, 25.0, 1.0))));<br>=A0 writel=
n(a);<br>}<br><br><br><br>
--20cf307abe49bfc8ef04acca47df--
Sep 12 2011








Caligo <iteronvexor gmail.com>