[llvm-bugs] [Bug 31545] New: Exceptions broken with -m32 -g

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jan 5 03:40:38 PST 2017


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: unassignedclangbugs at nondot.org
          Reporter: labath at google.com
                CC: llvm-bugs at lists.llvm.org
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170105/392748d7/attachment.html>


More information about the llvm-bugs mailing list