title: why change "complex*16" to "complex(16)" cause the runtime increased unreasonably in fortran?
body: <p>This fortran code was originally written in Fortran 77 format(I will show it later). After I got it, I changed it into f90 free format via a converting tool. Using <strong>intel fortran compiler</strong> <code>ifort</code>, the compiation and running is just as fine as before.</p>
  
  <p>Then I want to do more, I want to transform nonstandard，obsolete data type declaration f77 style like: <code>real*8</code>, <code>complex*16</code> etc into f90 standard <code>real(8)</code>, <code>complex(16)</code>. </p>
  
  <p>But I found an unbelievable thing. <strong>I just changed one "complex*16" into "complex(16)", then the running time increased from 10 seconds to 2 minutes. How could it be!!??</strong> Can someone explain this abnormal behaviour in fortran?</p>
  
  <hr>
  
  <p><strong>Below is the details</strong></p>
  
  <p><strong>The source file can be downloaded</strong> <a href="http://www.321webs.com/download/98398.htm" rel="nofollow">source code download link 1</a> or <a href="https://drive.google.com/file/d/0By4WA9GK6t9DbS1keUpQbUNXWWM/view?usp=sharing" rel="nofollow">souce code download link 2</a></p>
  
  <p>first, you could compile the f90 file using ifort, ignoring all the warning as</p>
  
  <pre><code>ifort -w test-16.f90
  </code></pre>
  
  <p>and run</p>
  
  <pre><code>./a.out
  </code></pre>
  
  <p>it will be finished in about 10 second (depends on your computer).</p>
  
  <p>Now, we make a small change. Go to line 734, this line reads</p>
  
  <pre><code>  Complex *16 ch, clamda, czero, cspw, com, phase, ctemp
  </code></pre>
  
  <p>it is f77 obsolete style, so change it into f90 standard</p>
  
  <pre><code>  Complex(16) ch, clamda, czero, cspw, com, phase, ctemp
  </code></pre>
  
  <p>and compile in the same way, ifort will show an error</p>
  
  <pre><code>/tmp/ifortvaXMFi.o: In function `fite4_':
  test-(16).f90:(.text+0x9ecf): undefined reference to `dimag_'
  test-(16).f90:(.text+0xa354): undefined reference to `dimag_'
  </code></pre>
  
  <p>I don't know why, but I figure out that there is a very suspicious sentence in line 744</p>
  
  <pre><code>  aimag(ctemp) = dimag(ctemp)
  </code></pre>
  
  <p>I really don't understand what does mean. But the whole code only has three places that "ctemp" appear. So apparently, this line is rebundant. So we can safely delete it.</p>
  
  <p>So after deleting line 744, the compilation is OK. But the running time as I said before increased to more than 2 minutes. It is really unbelievable, what is wrong here?</p>