Internal error during IncrCalcPtrs - does not recur when I run the code the 2nd time
<p>The project holding the code has all default MSVS2008 settings.</p>

<p>Consider the following code using which I am familiarizing myself with various offerings of STL:</p>

<pre><code>#include &lt;vector&gt;
#include &lt;iostream&gt;
#include &lt;numeric&gt;

using namespace std;


template &lt;class T&gt; void print(const vector&lt;T&gt;&amp; l)
{  // A generic print function for vectors
    cout &lt;&lt; endl &lt;&lt; "PV Size of vector is " &lt;&lt; l.size() &lt;&lt; "\n[";
    for(int i = 0; i &lt; l.size(); i++)
    {
        cout&lt;&lt;l[i]&lt;&lt;",";
    }
    cout &lt;&lt; "]\n";
}


int main()
{
    vector&lt;double&gt; vec1(4, 2.0);
    vector&lt;double&gt; vec2(4, 4.0);
    double init = 0.0;
    double summation = accumulate(vec1.begin(), vec1.end(), init);
    cout&lt;&lt;"Summation = "&lt;&lt;summation&lt;&lt;", init is "&lt;&lt;init&lt;&lt;endl;

    double ip = inner_product(vec1.begin(), vec1.end(), vec2.begin(), init);
    cout&lt;&lt;"ip = "&lt;&lt;ip&lt;&lt;", init is "&lt;&lt;init&lt;&lt;endl;

    int size = 6;
    int seed_value = 2;
    vector&lt;int&gt; vec3(size, seed_value);
    vector&lt;int&gt; result(size);
    partial_sum(vec3.begin(), vec3.end(), result.begin());
    cout&lt;&lt;"The partial sum of vec3 is ";
    print(vec3);

    int sz = 10;
    int value = 2;
    vector&lt;int&gt; vec4(sz);
    for(int it = 0; it &lt; vec4.size(); it++){
        vec4[it] = value;
        value++;
    }
    vector&lt;int&gt; result2(vec4.size());
    adjacent_difference(vec4.begin(), vec4.end(), result2.begin());
    cout&lt;&lt;"Adjacent differenec of vec4 is ";
    print(vec4);

    return(0);
}
</code></pre>

<p>The first time I try to run this (under Windows 7, Visual Studio 2008) I get the following error:</p>

<pre><code>c:\programming\numeric_algorithms_on_vectors.cpp(86) : warning C4018: '&lt;' : signed/unsigned mismatch

c:\programming\numeric_algorithms_on_vectors.cpp(37) : warning C4018: '&lt;' : signed/unsigned mismatch

c:\programming\numeric_algorithms_on_vectors.cpp(81) : see reference to function template instantiation 'void print(const std::vector&lt;_Ty&gt; &amp;)' being compiled

        with
        [
            _Ty=int
        ]

Linking...

numeric_algorithms_on_vectors.obj : fatal error LNK1000: Internal error during     IncrCalcPtrs
  Version 9.00.30729.01
  ExceptionCode            = C0000005
  ExceptionFlags           = 00000000
  ExceptionAddress         = 00E6B8C0 (00E10000) "C:\Program Files (x86)\Microsoft     Visual Studio 9.0\VC\bin\link.exe"
  NumberParameters         = 00000002
  ExceptionInformation[ 0] = 00000000
  ExceptionInformation[ 1] = 0000001C
CONTEXT:
  Eax    = 00000000  Esp    = 0042EAE8
  Ebx    = 3FFF0000  Ebp    = 0042EB04
  Ecx    = 77CB36FA  Esi    = 4000AF9C
  Edx    = 4000F774  Edi    = 00000000
  Eip    = 00E6B8C0  EFlags = 00010293
  SegCs  = 00000023  SegDs  = 0000002B
  SegSs  = 0000002B  SegEs  = 0000002B
  SegFs  = 00000053  SegGs  = 0000002B
  Dr0    = 00000000  Dr3    = 00000000
  Dr1    = 00000000  Dr6    = 00000000
  Dr2    = 00000000  Dr7    = 00000000
</code></pre>

<p>Yet, after clicking through the windows that tell me that my code did not compile/work properly, when I debug the same code again without making any changes to the code whatsoever, the program works. Is there a reason why the code would not compile/link/run the first time, yet run perfectly fine the next time?</p>
