https://llvm.org/bugs/show_bug.cgi?id=31545

            Bug ID: 31545
           Summary: Exceptions broken with -m32 -g
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: -New Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

$ cat /tmp/a.cc
int foo(void) { return 0; }

int main() {
  try {
    throw 10;
  } catch (...) {
  }
  return 0;
}


$ .../clang++  -g -m32 /tmp/a.cc -o a.out && ./a.out
terminate called after throwing an instance of 'int'
Aborted

=> The app crashes due to uncaught exception even though it should be caught

Things to note:
- the problem goes away if I remove "-g" from the command line
- the problem goes away if I remove "-m32" from the command line
- the problem goes away if I remove the "foo" declaration from a.cc

If I look at the intermediate .S file, I see that the thing in common for all
these three scenarios is that the ".cfi_sections .debug_frame" directive
dissapears.

My guess to what is going on is:
- we look at the first function, see that it cannot throw an exception, but we
still want to generate unwind info for the debugger, so we decide to use the
.debug_frame section.
- the second function *does* use need the unwind info, but now it's too late to
change the section, so it still ends up in .debug_frame.
- now the exception unwinder cannot find the unwind info at runtime

This bug was introduced recently, but I don't have an exact commit for it. I am
hoping that the problem will be sufficiently obvious to someone who is familiar
with the code in question.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to