Re: gcc optimizer bug with Boost ?
Re: gcc optimizer bug with Boost ?
- Subject: Re: gcc optimizer bug with Boost ?
- From: Bill Northcott <email@hidden>
- Date: Thu, 5 Feb 2004 08:30:19 +1100
From: Andrew Kimpton <email@hidden>
Subject: gcc optimizer bug with Boost ?
Date: Tue, 3 Feb 2004 17:01:58 -0800
I'm having a problem with boost shared_ptr's and some code built using
XCode 1.1. A member variable (a pointer) inside the boost::
sp_counted_base_impl seems to be getting corrupted with optimization
set to -01 or higher.
Strangely the same code called from a different executable built
separately but with -03 works fine. Equally adding some debug printf()s
to the boost headers causes the problem to go away which seems to
indicate that perhaps there's a race condition or similar (the boost
code is boost 1.30.2 and has the thread macros defined, the same
problem appears to exist with boost 1.30.0 too).
I'd like to try and track down who's 'stomping' on the pointer - but I
can't seem to quite work out how to set a watchpoint on the variable,
especially since the boost headers use a lot of inline template code
which seems to confuse gdb/Xcode debugger a lot (can't step inside
functions, functions don't show up correctly on the stack crawl etc).
Is anyone else using boost and experience similar crashes ? Any hints
on how to track down the offending code to take it apart and see if
it's truly a compiler problem or a bug in my own code ?
I recently compiled Tcl/Tck 8.4.5 unix style with X11 using Xcode and
got similar trashed pointer problems.
TclTk defaults to using -Os. Indeed you need to get quite aggressive
to stop it.
I rebuilt Tcl/Tk with -O0 so I could debug it and the problem went
away. I have not reproduced it. Indeed it still worked OK when I
built it with -O2.
Also I should warn you that I monkey about with compilers. The bad
Tcl/Tk was built with gcc-1480, whereas the default in Xcode 1.1 is
gcc-1495. I do this because I have problems with bugs in Apple current
release compilers building Objective-C code to use the GNU runtime. A
couple of days back, I pulled tag gcc_os-1555 from apple's opensource
CVS. It seems to have fixed our problems and runs very quickly. It
does however spew more warnings. Hopefully this is a pre-release of
the next Xcode compiler.
Bill Northcott
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.