This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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]

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


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