+Kuba, Anna in case they have any ideas, or are able to reproduce it under Apple Clang.
On Thu, Jun 18, 2015 at 9:37 AM, Stefan Haller <[email protected]> wrote: > I'm getting a container overflow failure that I think is a false > positive; but I don't understand what's going on, so I'm posting here > instead of filing an issue. Here's the most stripped-down example that I > could come up with: > > #include <vector> > #include <boost/range/any_range.hpp> > > template <typename T> > using AnyRange = > boost::any_range<T, > boost::random_access_traversal_tag, > T, > std::ptrdiff_t>; > > int main(int argc, const char * argv[]) > { > std::vector<int> v{1, 2, 3}; > v.erase(v.begin() + 1); > int i = 42; > AnyRange<int> range{&i, &i + 1}; > v.insert(v.begin() + 1, boost::begin(range), boost::end(range)); > assert(v[0] == 1); > assert(v[1] == 42); > assert(v[2] == 3); > return 0; > } > > This triggers the container overflow error inside the insert call, when > it tries to copy-construct the int at v.end(), which is inside the > allocated memory of the vector. > > Replacing the insert line with > > v.insert(v.begin() + 1, &i, &i + 1); > > makes it work. Also, changing the Reference argument of the any_range > (third template argument) to "T&" or "const T&" also makes it work. And > of course, running the test without AddressSanitizer succeeds, so it > doesn't look like it's actually overwriting memory. > > I tested this with boost 1.55 and 1.56. I'm on Mac OS X 10.10, with > clang++ version "Apple LLVM version 7.0.0 (clang-700.0.53)", x86_64. > AddressSanitizer is the one that comes bundled with the Xcode 7 beta > (not sure how to find out which version or revision that is). > > Any idea what's going on? > > Thanks, Stefan. > > -- > You received this message because you are subscribed to the Google Groups > "address-sanitizer" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Alexey Samsonov, Mountain View, CA -- You received this message because you are subscribed to the Google Groups "address-sanitizer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
