title: SSE addition producing garbage
body: <p>I am trying to compare SSE float[4] addition to standard float[4] addition. I tried this:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  struct Point4
  {
    Point4()
    {
      data[0] = 0;
      data[1] = 0;
      data[2] = 0;
      data[3] = 0;
    }
  
    float data[4];
  };
  
  static float SumOfDifferences(const Point4&amp; a, const Point4&amp; b)
  {
    // This function only returns the sum of the sum of the components
    float sumValues = 0.0f;
    for(unsigned int i = 0; i &lt; 4; ++i)
    {
      sumValues += a.data[i] + b.data[i];
    }
    return sumValues;
  }
  
  void Standard()
  {
    Point4 a;
    a.data[0] = 1;
    a.data[1] = 2;
    a.data[2] = 3;
    a.data[3] = 4;
  
    Point4 b;
    b.data[0] = 1;
    b.data[1] = 6;
    b.data[2] = 3;
    b.data[3] = 5;
  
    float total = 0.0f;
    for(unsigned int i = 0; i &lt; 1e6; ++i)
    {
      total += SumOfDifferences(a, b);
    }
  
    std::cout &lt;&lt; "total: " &lt;&lt; total &lt;&lt; std::endl;
  }
  
  void Vectorized()
  {
    typedef int v4sf __attribute__ (( vector_size(4*sizeof(float)) ));
  
    v4sf a;
    float* aPointer = (float*)&amp;a;
    aPointer[0] = 1; aPointer[1] = 2; aPointer[2] = 3; aPointer[3] = 4;
  
    v4sf b;
    float* bPointer = (float*)&amp;b;
    bPointer[0] = 1; bPointer[1] = 2; bPointer[2] = 3; bPointer[3] = 4;
  
    float total = 0.0f;
    v4sf result;
    float* resultPointer = (float*)&amp;result;
  
    for(unsigned int i = 0; i &lt; 1e6; ++i)
    {
      result = a + b; // Vectorized operation
  
      // Sum the components of the result (this is done with the "total += " in the Standard() loop
      for(unsigned int component = 0; component &lt; 4; ++component)
      {
        total += resultPointer[component];
      }
    }
  
    std::cout &lt;&lt; "total: " &lt;&lt; total &lt;&lt; std::endl;
  }
  
  int main()
  {
  
  //  Standard();
  
    Vectorized();
  
    return 0;
  }
  </code></pre>
  
  <p>but the output is 'inf' for the Vectorized() function. When I stepped through with a debugger, the values of 'result' seem to be garbage (i'd expect them to be (0, 4, 0, 1) ). Where am I going wrong here?</p>