g++ Internal compiler error in small program <p>I am writing a small program to solve Project Euler <a href="https://projecteuler.net/problem=21" rel="nofollow">Problem 21</a>, and I was testing out the early parts of my code when I ran into an unexplained internal compiler error. I'd appreciate any tips on how to re-write my program to avoid this kind of error.</p> <p>Here's my build command and compiler options:</p> <pre><code>g++ -std=c++11 -O2 -Wall -o "pe_021" "pe_021.cc" </code></pre> <p>Here's the error that I get:</p> <pre><code>Internal compiler error: Error reporting routines re-entered. Compilation failed. </code></pre> <p>Here's my code:</p> <pre><code>#include &lt;array&gt; #include &lt;iostream&gt; #include &lt;fstream&gt; #include &lt;vector&gt; using namespace std; const unsigned int N = 10000; //look for amicable numbers smaller than N vector&lt;unsigned int&gt; list_of_primes; vector&lt;unsigned int[2]&gt; prime_factorize(unsigned int); int main(int argc, char **argv) { //import a list of primes ifstream ifs ("primes_10000.txt"); for (unsigned int index = 0; index &lt; N; index++) { string prime_number; getline(ifs, prime_number); list_of_primes.push_back(stoi(prime_number)); } ifs.close(); //test prime factorization function by prime factorizing 12 vector&lt;unsigned int[2]&gt; prime_factorization = prime_factorize(12); for(unsigned int (&amp;prime_and_exponent)[2] : prime_factorization) { cout &lt;&lt; prime_and_exponent[0] &lt;&lt; ", " &lt;&lt; prime_and_exponent[1] &lt;&lt; endl; } return 0; } vector&lt;unsigned int[2]&gt; prime_factorize(unsigned int number) { vector&lt;unsigned int[2]&gt; prime_factorization; for(unsigned int index = 1; index &lt; list_of_primes.size(); index++) { if(number % list_of_primes[index] == 0) { unsigned int prime_and_exponent[2] = {list_of_primes[index], 1}; prime_factorization.push_back(prime_and_exponent); number /= list_of_primes[index]; while(number % list_of_primes[index] == 0) { prime_factorization.back()[1]++; number /= list_of_primes[index]; } } if(number == 1) { break; } } return prime_factorization; } </code></pre>