Hello List (and Ruben and Kai)! We got the answer from comp.lang.c++, and it looks like it's ill-formed code. (See below.)
(But Ruben, your build is still wacky!) On Sun, Nov 6, 2011 at 10:18 AM, K. Frank <[email protected]> wrote: > Hello Ruben! > ... >> and I would like to urge you to put it up on SO nonetheless. >> Specify platform (size of long, size_t), what you think should happen, and >> what happens, and just ask for an explanation of he behavior. It's a nice >> question IMHO, and chances are you'll get your answer fast. > ... > Okay, we'll give the experts a crack at this. I've posted the question to > comp.lang.c++, rather than Stack Overflow, but we should be able to > find some experts there, as well. We got a quick answer over at comp.lang.c++ > >> Ruben >> >> PS: send me a link to the question once posted, so I can fix it up a bit if >> necessary and give you an upvote ;) >> ... > > Okay, here's a link: > > groups.google.com/group/comp.lang.c++/browse_thread/thread/ce2528bce8c29935 You can see the discussion at the above link. To summarize, the problem is in if (pos != std::string::npos) { // 32-bit unsigned compared against 64-bit size_t std::string tmp(m_string.begin(), m_string.begin() + pos + 1); Once the bad value of pos (unsigned 32-bit -1) leaks through the if statement, we try to index into m_string with a bad iterator,: ((m_string.begin() + pos) + 1) My understanding is that creating (or perhaps using) the bad iterator constitutes undefined behavior, and, in practice, the compiler is probably overwriting all kinds of things when trying to construct the string tmp. I will say that I don't see this as a "language-lawyer" problem, but more of a problem with my less-than-sharp eyes... > ... Thanks for everyone's help. K. Frank ------------------------------------------------------------------------------ RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
