https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68409
Bug ID: 68409 Summary: Garbage added to a map instead of object Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: f3rn4nd0.c354r+gcc at gmail dot com Target Milestone: --- Created attachment 36754 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36754&action=edit gzip file with content description in message Hy, I'm no expert in GCC or C++, so this is my try in reporting what seems to be a bug in g++. I have debugged this a lot, and finally concluded it should be related to GCC when clang++ produced the expected result. I don't really know where or what bug this is, so this may be duplicated, or solved in new versions. The symptom is that an apparent bug free code receives an SEGFAULT. I deleted most of the code to achieve a small example, but it is still rather verbose, since I have no idea where this bug comes from (notice that 20 objects are inserted in a map and only 1 reveals this bug). The bug appears in line 71016 of gestor_de_chaves.ii Object c is a correct "chave" (this is the name of the object) but then, after adding it to the "frq_chaves" map, it is turned to garbage. I'm using Debian GNU/Linux 8 If I can be of service, please let me know. Brief description of files included: chave -> object type euromilhoes -> main file gestor_de_chaves -> code that reveals bug entrada_saida -> code to read data file euromilhoesOriginal.txt -> data file Description of code: My code reads a file, line by line, and creates an object with the data from which line. Each line starts with a number, which I will call the object number. To list repeated objects, I read the file, and then create a map where the key is the created object and the value is a list of object numbers. However object 18 is never introduced into the map, instead garbage data is added. I've debugged the further I could (inclusive into the map and list code of the standard library) without success. The object is correctly created, but not added.