[cfe-dev] Small fix on ExplodedGraph.cpp for review

Ted Kremenek kremenek at apple.com
Sun Apr 20 16:53:39 PDT 2008


Thanks!  Applied!

On Apr 20, 2008, at 1:58 PM, Argiris Kirtzidis wrote:

> Hi,
>
> The attached patch contains:
>
> -  else
> -    return  
> const_cast<ExplodedNodeImpl**>(&*(getVector(getPtr()).end()));
> +  else {
> +    // Dereferencing end() is undefined behaviour. The vector is  
> not empty, so
> +    // we can dereference the last elem (end()-1) and then add 1 to  
> the result.
> +    return  
> const_cast<ExplodedNodeImpl**>(&*(getVector(getPtr()).end()-1)) + 1;
> +  }
>
> MSVC's STL checks invalid dereferences (like on end()) and throws  
> assertion error.
>
> -Argiris
> <ExplodedGraph- 
> fix.patch>_______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list