title: Where does this code segfault?
body: <p>My question, now reduced to a - hopefully - minimal example, is why the following code segfaults.</p>
  
  <p>It can of course be seen as a duplicate of the proposed question, provided you have found the latter. The problem is, I failed to find the question in my initial search and so may many newbies, not knowing the cause of error. I propose this as a duplicate I could have found: </p>
  
  <p><a href="https://stackoverflow.com/questions/20253267/segmentation-fault-before-main">Segmentation Fault before main</a></p>
  
  <p>but the problem description is very long, so that I believe my minimised and much shorter code might be better for illustrating the problem. In any case, it is a duplicate. <strong>I propose the moderators set this as a duplicate and set a link from the second possible duplicate to the first one.</strong> </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  
  /* Parameters */
  #define N 3072  
  #define LDA N
  
  /* Main program */
  int main()  {
          printf( "-----------------------------------------------&gt; Entry main.\n" );
          /* Local arrays */
      double a[LDA*N];
          printf( "-----------------------------------------------&gt; End main.\n" );
  return 0;        
  }
  </code></pre>
  
  <p>A segfault does not occur when </p>
  
  <pre><code>#define N 3072
  </code></pre>
  
  <p>is replaced by </p>
  
  <pre><code>#define N 5
  </code></pre>
  
  <p>Neither does a segfault occur when the line </p>
  
  <pre><code>double a[LDA*N];
  </code></pre>
  
  <p>is omitted. </p>
  
  <p>I am especially confused by the observation that the segfault occurs without reaching</p>
  
  <pre><code>printf( "-----------------------------------------------&gt; Entry main.\n" );
  </code></pre>
  
  <p>which I put directly at the beginning of main.</p>
  
  <p>For completeness, I run the code like this:</p>
  
  <pre><code>ludi@ludi-M17xR4:~/Desktop/tests$ g++ -o minicombo.x minicombo.cc &amp;&amp; ./minicombo.x
  </code></pre>