Very odd OS X Leopard crash

Hello list I got some code that have been working fine on Win/Linux/OS X Tiger for a while now. When I got my new OS X box I got Leopard, and when trying to build our project it built fine, but it failed to start at all when i made release mode compiles, but debug mode worked just fine. It seemed it didnt even get into my main().. After a number of hours I've narrowed it down to posix_time.hpp and strip.. Example: test.cpp: #include <boost/date_time/posix_time/posix_time.hpp> int main(int argc, char const ** argv) { } Compiling it (simple jamfile but easier to just paste this) johan-mp ~$ g++-4.0 -ftemplate-depth-128 -O3 -finline-functions -Wno- inline -Wall -fPIC -dynamic -Wno-long-double -no-cpp-precomp - DNDEBUG -I"/Users/johan/boost_1_34_1" -c -o "test.o" "test.cpp" johan-mp ~$ g++-4.0 -o "test" "test.o" johan-mp ~$ g++-4.0 -o "test" "test.o" johan-mp ~$ ./test johan-mp ~$ strip test johan-mp ~$ ./test zsh: bus error ./test johan-mp ~$ gdb ./test GNU gdb 6.3.50-20050815 (Apple version gdb-768) (Tue Oct 2 04:07:49 UTC 2007) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-apple-darwin"...Reading symbols for shared libraries .... done (gdb) run Starting program: /Users/johan/test Reading symbols for shared libraries +++. done Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x00000000 0x00001f84 in ?? () (gdb) where #0 0x00001f84 in ?? () #1 0x00001f00 in ?? () Previous frame inner to this frame (gdb could not unwind past this frame) (gdb) So, if i remove the #include for posix_time.hpp it works fine. Or if I skip the strip part.... The GDB output here doesnt give much but the trace from the original project looks like this: 0x00491c04 in typeinfo name for boost ::detail ::sp_counted_impl_p < boost ::filesystem ::basic_filesystem_error<boost::filesystem::basic_path<std::string, boost::filesystem::path_traits> >::m_imp> () (gdb) where #0 0x00491c04 in typeinfo name for boost ::detail ::sp_counted_impl_p < boost ::filesystem ::basic_filesystem_error<boost::filesystem::basic_path<std::string, boost::filesystem::path_traits> >::m_imp> () #1 0x00000000 in ?? () Doesnt say much either.. I've also managed to get traces like this (not from gdb but osx crashlog): 0 myapp 0x004af69d 0x1000 + 4908701 1 dyld 0x8fe12e76 ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 246 2 dyld 0x8fe0e723 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int) + 307 3 dyld 0x8fe0e809 ImageLoader::runInitializers(ImageLoader::LinkContext const&) + 57 4 dyld 0x8fe04102 dyld::initializeMainExecutable() + 146 5 dyld 0x8fe07b5f dyld::_main(mach_header const*, unsigned long, int, char const**, char const**, char const**) + 2975 6 dyld 0x8fe01872 dyldbootstrap::start(mach_header const*, int, char const**, long) + 818 7 dyld 0x8fe01037 _dyld_start + 39 The original project was working perfectly fine on OS X Tiger (release & debug mode), and the tiger build works fine on leopard too, but when built on my leopard in release mode it fails... Does anyone have any clues whatsoever what this can be?? boost is 1.34.1 where only change is user-config.jam with using darwin : 4.0 : g++-4.0 ; Thank you for any ideas -- Johan Ström Systems Engineer Headweb AB johan@headweb.com

on Wed Feb 27 2008, Johan Ström <johan-AT-headweb.com> wrote:
Does anyone have any clues whatsoever what this can be?? boost is 1.34.1 where only change is user-config.jam with using darwin : 4.0 : g++-4.0 ;
Optimizer bug? Try compiling the file manually and twiddling the compiler flags (e.g. using -O1 instead of -O2, turning off inlining, etc). -- Dave Abrahams Boost Consulting http://boost-consulting.com
participants (2)
-
David Abrahams
-
Johan Ström