[llvm-bugs] [Bug 25162] New: [WinEH] cleanuppad funclets for C++ EH cannot catch exceptions

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 13 11:24:24 PDT 2015


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

            Bug ID: 25162
           Summary: [WinEH] cleanuppad funclets for C++ EH cannot catch
                    exceptions
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: rnk at google.com
                CC: david.majnemer at gmail.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

Consider this example:

extern "C" int puts(const char *);
struct HasDtor {
  /*__forceinline*/ ~HasDtor() {
    try {
      throw 2;
    } catch (int) {
      puts("catch ~HasDtor");
    }
  }
};
int main() {
  try {
    HasDtor o;
    throw 1;
  } catch (int) {
    puts("catch main");
  }
}

clang-cl can compile and run this as expected with the __forceinline commented
out, but uncommenting it makes the program call std::terminate at runtime.

Right now our C++ cleanup funclets don't have pointers to cppxdata. It's not
clear to me if we can make cleanup funclets just like catch handlers here,
where the cleanup funclet references the parent xdata table. If we can do that,
then this will be easy.

If cleanup funclets need their own xdata tables, then we have to change things
up a bit.

-- 
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/20151013/fdfdb92a/attachment.html>


More information about the llvm-bugs mailing list