This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

segfault with -O3, map::insert(), and make_pair()


Using g++ 3.0.4 on Mandrake 8.2, building a shared library but with
the C++ runtime libraries statically linked into that shared library.

Using -O3, I had some trouble with function calls like the following:
   i_currAddTable = tm.insert(tm.end(), make_pair(tablename,fieldSet()));
(tm is a map, tablename is a string, fieldSet is a set)

This statement would sometimes (but very reproducibly) segfault.
If I changed this so that I created the pair (new) outside this statement,
and then did tm.insert(tm.end(), *myNewPair), then the problem went away.
Also, if I changed the optimization level from -O3 to -O2, then the problem
went away.

The shared library is being called from Java and one other language
environment as well. The error was reproducible from both environments.

Something to do with the inlining in -O3 maybe?

HTH, sorry I can't do more with it at the moment.

Regards,
John


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]