Skip to content

Cannot catch exceptions on Apple M1 #49036

Open
@hahnjo

Description

@hahnjo
Bugzilla Link 49692
Version trunk
OS MacOS X
CC @AlexDenisov,@Axel-Naumann,@lhames,@vgvassilev

Extended Description

On arm64-apple-darwin20.3.0, consider the following code:

 % cat test.cc
int main() {
  try {
    throw 1;
  } catch (...) { }
}

When compiled into an executable (by either Apple clang or Clang trunk), the program exits normally:

 % clang++ -O2 throw.cc -o throw
 % ./throw
 % echo $?
0

However, the same code crashes when compiling into LLVM IR and executing via lli:

 % clang++ -O2 -S -emit-llvm throw.cc
 % lli throw.ll
libc++abi.dylib: terminating with uncaught exception of type int

I've tried all combinations of --jit-kind and --jit-link, none of them worked.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions