Is this a bug?

Caligo iteronvexor at gmail.com
Mon Sep 12 20:31:33 PDT 2011


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);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20110912/4aa710f3/attachment.html>


More information about the Digitalmars-d-learn mailing list