http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55610
--- Comment #5 from Jack Howarth <howarth at nitro dot med.uc.edu> 2012-12-07 18:03:05 UTC --- It appears that the change in Comment 4 only works if dragonegg is built with clang. Using the patch from http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056882.html to allow dragonegg 3.2 to be built against FSF gcc 4.7.2 exposes a new runtime bug from this change... % gdb /sw/lib/gcc4.7/libexec/gcc/x86_64-apple-darwin12.2.0/4.7.2/cc1 GNU gdb 6.3.50-20050815 (Apple version gdb-1822) (Sun Aug 5 03:00:42 UTC 2012) 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 "x86_64-apple-darwin"...Reading symbols for shared libraries .. ...... done (gdb) break malloc_error_break Function "malloc_error_break" not defined. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 1 (malloc_error_break) pending. (gdb) r -quiet -v -iplugindir=/sw/lib/gcc4.7/lib/gcc/x86_64-apple-darwin12.2.0/4.7.2/plugin -D__DYNAMIC__ himenoBMTxpa.c -iplugindir=/sw/lib/gcc4.7/lib/gcc/x86_64-apple-darwin12.2.0/4.7.2/plugin -fPIC -quiet -dumpbase himenoBMTxpa.c -mmacosx-version-min=10.8.2 -mtune=core2 -auxbase himenoBMTxpa -O3 -version -fplugin=/sw/lib/gcc4.7/lib/dragonegg.so -fplugin-arg-dragonegg-llvm-option=-load:/sw/opt/llvm-3.2/lib/LLVMPolly.so -fplugin-arg-dragonegg-llvm-option=-polly -o /var/folders/1l/n78sywl52lz6kkys6nv7mnph0000gp/T//cclH687b.s Starting program: /sw/lib/gcc4.7/libexec/gcc/x86_64-apple-darwin12.2.0/4.7.2/cc1 -quiet -v -iplugindir=/sw/lib/gcc4.7/lib/gcc/x86_64-apple-darwin12.2.0/4.7.2/plugin -D__DYNAMIC__ himenoBMTxpa.c -iplugindir=/sw/lib/gcc4.7/lib/gcc/x86_64-apple-darwin12.2.0/4.7.2/plugin -fPIC -quiet -dumpbase himenoBMTxpa.c -mmacosx-version-min=10.8.2 -mtune=core2 -auxbase himenoBMTxpa -O3 -version -fplugin=/sw/lib/gcc4.7/lib/dragonegg.so -fplugin-arg-dragonegg-llvm-option=-load:/sw/opt/llvm-3.2/lib/LLVMPolly.so -fplugin-arg-dragonegg-llvm-option=-polly -o /var/folders/1l/n78sywl52lz6kkys6nv7mnph0000gp/T//cclH687b.s Reading symbols for shared libraries +++++++................................. done Breakpoint 1 at 0x7fff94c3a558 Pending breakpoint 1 - "malloc_error_break" resolved Reading symbols for shared libraries ... done GNU C (GCC) version 4.7.2 (x86_64-apple-darwin12.2.0) compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.1, MPC version 1.0.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Versions of loaded plugins: dragonegg: 3.2svn ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/sw/lib/gcc4.7/lib/gcc/x86_64-apple-darwin12.2.0/4.7.2/../../../../x86_64-apple-darwin12.2.0/include" #include "..." search starts here: #include <...> search starts here: /sw/lib/gcc4.7/lib/gcc/x86_64-apple-darwin12.2.0/4.7.2/include /sw/lib/gcc4.7/include /sw/lib/gcc4.7/lib/gcc/x86_64-apple-darwin12.2.0/4.7.2/include-fixed /usr/include /System/Library/Frameworks /Library/Frameworks End of search list. GNU C (GCC) version 4.7.2 (x86_64-apple-darwin12.2.0) compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.1, MPC version 1.0.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Versions of loaded plugins: dragonegg: 3.2svn Compiler executable checksum: d6e497ca0091e30b5d839f153b884a35 himenoBMTxpa.c: In function ‘main’: himenoBMTxpa.c:79:5: warning: incompatible implicit declaration of built-in function ‘strcpy’ [enabled by default] himenoBMTxpa.c: In function ‘set_param’: himenoBMTxpa.c:226:5: warning: incompatible implicit declaration of built-in function ‘exit’ [enabled by default] himenoBMTxpa.c: In function ‘newMat’: himenoBMTxpa.c:239:5: warning: incompatible implicit declaration of built-in function ‘malloc’ [enabled by default] himenoBMTxpa.c: In function ‘clearMat’: himenoBMTxpa.c:248:5: warning: incompatible implicit declaration of built-in function ‘free’ [enabled by default] Reading symbols for shared libraries ... done cc1(81254) malloc: *** error for object 0x7fff79fb8570: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug Breakpoint 1, 0x00007fff94c3a558 in malloc_error_break () (gdb) bt #0 0x00007fff94c3a558 in malloc_error_break () #1 0x00007fff94c3b912 in free () #2 0x0000000144c4fcb9 in std::string::assign (this=0x1451fe560, __str=<value temporarily unavailable, due to optimizations>) at basic_string.h:226 #3 0x0000000142f5ad84 in llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >::setInitialValue (this=0x1451fe528, V=@0x7fff5fbfdf78) at CommandLine.h:1162 #4 0x000000014512ee6d in llvm::cl::initializer<char [4]>::apply<llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> > > (this=0x7fff5fbfe068, O=@0x1451fe528) at CommandLine.h:290 #5 0x000000014512ee0d in llvm::cl::applicator<llvm::cl::initializer<char [4]> >::opt<llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> > > (M=@0x7fff5fbfe068, O=@0x1451fe528) at CommandLine.h:976 #6 0x000000014512eddd in llvm::cl::apply<llvm::cl::initializer<char [4]>, llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> > > (M=@0x7fff5fbfe068, O=0x1451fe528) at CommandLine.h:1014 #7 0x000000014512fbe0 in llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >::opt<char [24], llvm::cl::desc, llvm::cl::OptionHidden, llvm::cl::initializer<char [4]> > (this=0x1451fe528, M0=@0x1451ad7ca, M1=@0x7fff5fbfe078, M2=@0x7fff5fbfe074, M3=@0x7fff5fbfe068) at CommandLine.h:1197 #8 0x000000014512ea75 in llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >::opt<char [24], llvm::cl::desc, llvm::cl::OptionHidden, llvm::cl::initializer<char [4]> > (this=0x1451fe528, M0=@0x1451ad7ca, M1=@0x7fff5fbfe078, M2=@0x7fff5fbfe074, M3=@0x7fff5fbfe068) at CommandLine.h:1199 #9 0x000000014512e6ae in __cxx_global_var_init4 () at PassSupport.h:183 #10 0x000000014512e978 in global constructors keyed to a () at PassSupport.h:183 #11 0x00007fff5fc13378 in __dyld__ZN16ImageLoaderMachO18doModInitFunctionsERKN11ImageLoader11LinkContextE () #12 0x00007fff5fc13762 in __dyld__ZN16ImageLoaderMachO16doInitializationERKN11ImageLoader11LinkContextE () #13 0x00007fff5fc1006e in __dyld__ZN11ImageLoader23recursiveInitializationERKNS_11LinkContextEjRNS_21InitializerTimingListE () #14 0x00007fff5fc0feba in __dyld__ZN11ImageLoader15runInitializersERKNS_11LinkContextERNS_21InitializerTimingListE () #15 0x00007fff5fc04e38 in __dyld__ZN4dyld15runInitializersEP11ImageLoader () #16 0x00007fff5fc0a87c in __dyld_dlopen () #17 0x00007fff8bd81dd8 in dlopen () #18 0x0000000142f8f33f in llvm::sys::DynamicLibrary::getPermanentLibrary (filename=0x141328d58 "/sw/opt/llvm-3.2/lib/LLVMPolly.so", errMsg=0x7fff5fbfe7d0) at /sw/src/fink.build/llvm32-3.2-0/llvm-3.2/lib/Support/DynamicLibrary.cpp:77 #19 0x0000000142f706bd in llvm::sys::DynamicLibrary::LoadLibraryPermanently (Filename=0x141328d58 "/sw/opt/llvm-3.2/lib/LLVMPolly.so", ErrMsg=0x7fff5fbfe7d0) at DynamicLibrary.h:77 #20 0x0000000142f70489 in llvm::PluginLoader::operator= (this=0x1434a5c78, Filename=@0x7fff5fbfe870) at /sw/src/fink.build/llvm32-3.2-0/llvm-3.2/lib/Support/PluginLoader.cpp:29 #21 0x0000000142211328 in llvm::cl::opt_storage<llvm::PluginLoader, false, true>::setValue<std::string> (this=0x1434a5c78, V=@0x7fff5fbfe870, initial=<value temporarily unavailable, due to optimizations>) at CommandLine.h:1072 #22 0x0000000142211066 in llvm::cl::opt<llvm::PluginLoader, false, llvm::cl::parser<std::string> >::handleOccurrence (this=0x1434a5c40, pos=2, ArgName={static npos = 18446744073709551615, Data = 0x141325ea1 "load=/sw/opt/llvm-3.2/lib/LLVMPolly.so", Length = 4}, Arg={static npos = 18446744073709551615, Data = 0x141325ea6 "/sw/opt/llvm-3.2/lib/LLVMPolly.so", Length = 33}) at CommandLine.h:1131 #23 0x0000000142f54fb1 in llvm::cl::Option::addOccurrence (this=0x1434a5c40, pos=2, ArgName={Data = 0x141325ea1 "load=/sw/opt/llvm-3.2/lib/LLVMPolly.so", Length = 4, static npos = 18446744073709551615}, Value={Data = 0x141325ea6 "/sw/opt/llvm-3.2/lib/LLVMPolly.so", Length = 33, static npos = 18446744073709551615}, MultiArg=false) at /sw/src/fink.build/llvm32-3.2-0/llvm-3.2/lib/Support/CommandLine.cpp:883 #24 0x0000000142f59e2b in CommaSeparateAndAddOccurence (Handler=0x1434a5c40, pos=2, ArgName={Data = 0x141325ea1 "load=/sw/opt/llvm-3.2/lib/LLVMPolly.so", Length = 4, static npos = 18446744073709551615}, Value={Data = 0x141325ea6 "/sw/opt/llvm-3.2/lib/LLVMPolly.so", Length = 33, static npos = 18446744073709551615}, MultiArg=false) at /sw/src/fink.build/llvm32-3.2-0/llvm-3.2/lib/Support/CommandLine.cpp:259 #25 0x0000000142f552b1 in ProvideOption (Handler=0x1434a5c40, ArgName={Data = 0x141325ea1 "load=/sw/opt/llvm-3.2/lib/LLVMPolly.so", Length = 4, static npos = 18446744073709551615}, Value={Data = 0x141325ea6 "/sw/opt/llvm-3.2/lib/LLVMPolly.so", Length = 33, static npos = 18446744073709551615}, argc=4, argv=0x141325ed0, i=@0x7fff5fbff080) at /sw/src/fink.build/llvm32-3.2-0/llvm-3.2/lib/Support/CommandLine.cpp:299 #26 0x0000000142f53054 in llvm::cl::ParseCommandLineOptions (argc=4, argv=0x141325ed0, Overview=0x0) at /sw/src/fink.build/llvm32-3.2-0/llvm-3.2/lib/Support/CommandLine.cpp:724 #27 0x0000000142203c02 in ConfigureLLVM () at /sw/src/fink.build/dragonegg-gcc47-3.2-0/dragonegg-3.2/src/Backend.cpp:372 #28 0x0000000142204b38 in InitializeBackend () at /sw/src/fink.build/dragonegg-gcc47-3.2-0/dragonegg-3.2/src/Backend.cpp:583 #29 0x000000014220843b in llvm_emit_globals () at /sw/src/fink.build/dragonegg-gcc47-3.2-0/dragonegg-3.2/src/Backend.cpp:1741