Posta il codice che usi, perché secondo me il problema sta lì.
Amaro C++, il gusto pieno dell'undefined behavior.
Regole del Forum