This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
map and -O2
- From: Eric Bourque <ericb at computer dot org>
- To: libstdc++ at gcc dot gnu dot org
- Date: Sun, 14 Apr 2002 02:15:57 -0400
- Subject: map and -O2
Is there a known problem with using optimization and map? I am
consistently getting segfaults with code compiled with -O2 (gcc
3.0.4-linux-i686) for the following:
map<foo,bar> keys;
...
map<foo,bar>::iterator i=keys.begin();
cout << (*i).first << endl; // as soon as I dereference i the problem
occurs
oddly keys.size() returns the correct (positive) number of elements, so
I don't see how the iterators could be screwed up. All this stuff gets
inlined so it's real hard to debug.
Without -O2, the code works fine.
Any ideas or suggestions?
Cheers,
Eric
--
Eric Bourque
Ph.D. Candidate, Centre for Intelligent Machines, McGill University.
PGP Fingerprint : B57E FA15 E100 4C20 538F 56F0 78B9 582D 75C0 CFE0