Re: Is PGO (Profile Guided Optimization) incompatible with stl and /MD
John's solution: "ts.insert(1, "b");" solves this specific problem but I
already had figured out a work around for this situation.
My first question still stands: Is there a systematic problem with /MD, PGO
and stl?
After fixing this problem I found at least 2 more cases in the code I am
trying to optimize where a iterator check test fails involving other stl
containers and insert operations.
Unfortunately they are not as easy to isolate in a simple example as this
case. I was hoping to find out the root cause of this apparent bug.
Phil
"John Carson" <jcarson_n_o_sp_am_@netspace.net.au> wrote in message
news:OTOxBOSBHHA.4256@TK2MSFTNGP04.phx.gbl...
"Phil Borghesani" <PhilBorghesani@discussions.microsoft.com> wrote in
message news:1E492258-B202-4231-AD9F-E90CFA213E97@microsoft.com
This code when built with default console options and Instrumented
with for Profile Guided Optimization will Abort with a forced error
from _invalid_parameter. If the code is built normaly (debug or
release) it is fine and if I switch to /MT then the problem goes
away. Switching my full application to /MT is NOT an option.
Phil
// CODE started with a default console application
#include "stdafx.h"
#include <string>
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
std::string ts("A");
ts.insert(ts.begin()+1,'b');
std::cout<<"the string is " << ts << ".";
return 0;
}
If you replace
ts.insert(ts.begin()+1,'b');
with
ts.push_back('b');
or
ts.insert(1, "b");
then it works.
It would appear to be a bug that stops it working in your case (I can't
see anything wrong with your code). You can report it here:
http://connect.microsoft.com/feedback/default.aspx?SiteID=210
--
John Carson