[LLVMdev] Weird Exception Handling Compilation Bug

Bill Wendling isanbard at gmail.com
Mon Sep 10 14:42:21 PDT 2007


Hi all,

When I compile the following program with llvm-gcc on Mac x86, it segfaults:

int main(int argc, char **argv) {
  try {
    throw argc;
  } catch(int i) {
    return i;
  }

  return 0;
}

$ llvm-g++ -o t t.cpp
$ ./t
Segmentation fault

However, if I compile it to a .s file and then compile it with gcc, it
works fine:

$ llvm-g++ -S t.cpp -o zz.s
$ g++ -o zz zz.s
$ ./zz 1 2 3
$ echo $?
4

This is weird. Anyone have an idea of what's going on?

-bw



More information about the llvm-dev mailing list