title: segmentation fault with pointer in for loop
body: <p>The code compiles fine and runs fine until the for loop to iterate through f_read_Prediction_Set. The segmentation fault occurs directly after that line...what am I missing?</p>
  
  <pre><code>std::map&lt; RAddr, uint32_t &gt;* transCoherence::getCurrentSets(uint32_t log2AddrLs, uint32_t maskSets, uint32_t log2Assoc, int pid, RAddr caddr)//function to return prediction set
  {
     uint32_t set;
     std::map&lt; RAddr, uint32_t &gt;* currentSets = new std::map&lt; RAddr, uint32_t &gt;;
     std::map&lt; RAddr, uint32_t &gt;* f_read_Prediction_Set = new std::map&lt; RAddr, uint32_t &gt;;
  
     for(std::map&lt;RAddr, uint32_t&gt;::iterator it = f_read_Prediction_Set-&gt;begin(); it!=f_read_Prediction_Set-&gt;end(); ++it)
     {
        set = (((it-&gt;first) &gt;&gt; log2AddrLs) &amp; maskSets) &lt;&lt; log2Assoc;
        if(set == caddr)
           (*currentSets)[set] = 1;
     }
  
     return currentSets;
  }
  </code></pre>