[LLVMbugs] [Bug 13102] New: Clang generating wrong _cxa_rethrow call inside catch block for exception handling.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 13 05:46:05 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13102

             Bug #: 13102
           Summary: Clang generating wrong _cxa_rethrow call inside catch
                    block for exception handling.
           Product: clang
           Version: unspecified
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: rahulsingh.mnnit at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


int ad;
int r;

struct A {
  ~A() { ++ad; }
};

struct B: public A {
  ~B();
};

B::~B ()
try
  {
    throw 1;
  }
catch (...)
  {
    if (!ad)
      r = 1;
    return;
  }

int main ()
{
  { B b; }
  return r;
}



While trying this test case on the Linux machine , the above code letd to
"terminate called after throwing an instance of 'int'" error.


While analyzing the bytecode , 
there appears a call to cxa_rethrow inside the catch block of B's Destructor
which is leading to terminate inside the run-time libraries. 
The generation of call to _cxa_rethrow during the cleanup blocks seems to be a
totally incorrect statement generated by Clang front-end while generating
bytecode.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list