Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

STL causing seg faults - but possibly more fundamental linking problem...?

807575Apr 7 2004 — edited Apr 20 2004
I'm having a bizarre problem with STL functions in a rather large application I'm developing. I'm on a Solaris 2.8 using gcc 3.2.1

A few weeks ago, <set>.insert() was causing my application to seg fault - I assume an exception was being thrown, but I didn't note it at the time. I didn't understand why, though. gdb (v5.0) seemed to claim that the thing I was inserting was at an invalid memory location, although as far as the function calling insert was concerned it definately wasn't.

Still, after I changed ,set> to <list>, the problem magically went away.

But now, I'm haivng a problem with <string>.substr() - although I am attempting to extract a valid substring from a valid string (i.e. all the parameters are in range), my app is seg faulting... gdb seems to suggest
that an out of bounds exception is being thrown.

Normally at about this point I'd assume some kind of memory leak/corruption/overwrite problem... but I've run the app through purify and there is no undesirable behaviour up to the point of the seg fault itself.

My main problem is that I don't even understand how to start fixing this. As far as I can tell nothing I am doing is wrong, this code has been running happily for 6 months or so, it's just taken it upon itself to start falling apart now. It's as if the code has reached some kind of critical mass, so that adding unrelated functions elsewhere (which have not even been called at the opint the app is crashing) is cauing problems.

Frustratingly, if I recompile my app in Visual C++ on Windows, it starts up fine.

I'd appreciate any pointers anyone can give me on how to try to track this one down. Almost certainly it's something I'm doing, as opposed to a bug in STL...

Paul
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 18 2004
Added on Apr 7 2004
3 comments
85 views