Bug in icpc 8.1?

Bug in icpc 8.1?

I have the following code which with icpc 8.1 produces at runtime a"double free or corruption error". Could anyone tell me what's wrong. I've tested it with g++ 3.4.2 and microsoft c++ and works fine. Even with icpc, when I change line 'string* a = new string("SEID=1:SPC=1:MPC=2:");' in main to 'string* a = new string("SEID=1:SPC=1:MPC=2:SPC=2:");', works fine. Could it be a bugin icpc or should I check with my compile options?

#include
#include
#include
using namespace std;
class foo{
public:
void Parse(const string& str){
string::size_type idxeq = 0;
string::size_type idxdd = 0;
string::size_type idxst = 0;
string qual, sval;
string::size_type len = str.length();
do {
idxeq = str.find('=', idxst);
if (idxeq == string::npos)
return;
idxdd = str.find(':', idxeq);
qual = str.substr(idxst, idxeq - idxst);
sval = str.substr(idxeq + 1, idxdd - idxeq - 1);
cout << qual << "=" << sval << endl;
_Qualifiers[qual] = sval;
idxst = idxdd + 1;
}while(idxdd+1 < len);
}
private:
map _Qualifiers;
};
int main(){
foo f;
string* a = new string("SEID=1:SPC=1:MPC=2:");
f.Parse(*a);
delete a;
return 0;
}
Thank you in advance for any help
C.S.

1 contenuto / 0 nuovi
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione