title: FORALL causes stack overflow
body: <p>I am implementing a genetic algorithm to numerically estimate some coefficients in a system of ODEs based on experimental data. I am just learning Fortran along as I implement the algorithms. My config is a Intel Fortran 2015 running on Windows 7/Visual Studio 2013, on an old i7 processor.</p>
  
  <p>I have the following piece among a multitude of lines of code:</p>
  
  <pre><code>DO i = 1, N_CROMOSOMES
      IF (population(9,i) &lt; 0.0_DOUBLE) population(9, i) = square_error(population(1:8, i))
  END DO
  </code></pre>
  
  <p>Where I just defined DOUBLE to be:</p>
  
  <pre><code>INTEGER, PARAMETER :: DOUBLE = 16
  </code></pre>
  
  <p>N_CROMOSOMES is an INTEGER argument to the function, that defines the size of the array population, which in turn is a (9 x N_CROMOSOMES) array of type REAL(KIND=DOUBLE). For each column on this array, its first 8 elements represent the 8 coefficients that I am estimating, and the ninth element is the error associated with that particular 8 guesses for the coefficients. square_error is the function that determines it.</p>
  
  <p>In this point of the program, I have marked columns that were just created or that were altered as having an error of -1. Hence, the "IF (population(9,i)&lt;0.0_DOUBLE)": I am checking the columns of the array whose error is -1 in order to compute their error.</p>
  
  <p>The thing is, I just rewrote most of my code, and spent the past few days correcting mysterious bugs. Before this, the code worked just fine with a FORALL instead of DO. Now it says gives an error "stack overflow" when I use FORALL, but works with DO. But it takes a lot more time to do its job.</p>
  
  <p>Does anyone knows the cause of this, and also, how to solve it? It is clear to me that my code can highly benefit from paralellization, but I am not so sure how to do it.</p>
  
  <p>Thanks for your time.</p>