Hey All-

I've been continuing to dig into the phenomenon of code crashing when catching 
a C++ exception in a .mm file.  I'm finding that even though my test passes 
when it's included in the libobjc2 test bundle, it fails when I compile it from 
the command line.  I narrowed down the compilation command, and found that the 
seg fault stops happening if I remove -fgnu-runtime from the compile command 
(I've copied the commands and the program below).

Should I not be compiling with -fgnu-runtime when I'm using the libobjc2 
runtime?  

--David

Compilation command that results in crash:
/home/dlobron/build/clangport/akamai/llvm/llvm-5.0.0.install/bin/clang++ 
test.mm -c \
      -fPIC -Wall -Wall -Werror -fobjc-runtime=gnustep-1.8 -DHAVE_CONFIG_H 
-D_GNU_SOURCE -fgnu-runtime  -I .. -I ../../common/include \
           -o test.mm.o
/home/dlobron/build/clangport/akamai/llvm/llvm-5.0.0.install/bin/clang++   -o 
test \
    ./test.mm.o \
    -L../../common/lib -L..  -lobjc

Command with no crash (only change is remove -fgnu-runtime):
/home/dlobron/build/clangport/akamai/llvm/llvm-5.0.0.install/bin/clang++ 
test.mm -c \
      -fPIC -Wall -Wall -Werror -fobjc-runtime=gnustep-1.8 -DHAVE_CONFIG_H 
-D_GNU_SOURCE  -I .. -I ../../common/include \
           -o test.mm.o
/home/dlobron/build/clangport/akamai/llvm/llvm-5.0.0.install/bin/clang++   -o 
test \
    ./test.mm.o \
    -L../../common/lib -L..  -lobjc 

Program (C++ code in a .mm file):

$ cat test.mm
#include <iostream>

using namespace std;

int main(int argc, char *argv[]) {
  try {
    throw exception();
  } catch (exception &e) {
  }

  return 0;
}
_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to