[LLVMbugs] [Bug 13359] New: invalid codegen result in unexpected free of exception and crash

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 13 14:15:08 PDT 2012


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

             Bug #: 13359
           Summary: invalid codegen result in unexpected free of exception
                    and crash
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: devlists at shadowlab.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8893
  --> http://llvm.org/bugs/attachment.cgi?id=8893
Generated LLVM IR

While running the following code,  it crashes due to an invalid free operation:

exc(8657) malloc: *** error for object 0x7f97c14039e0: pointer being freed was
not allocated
*** set a breakpoint in malloc_error_break to debug
fish: Job 1, './exc' terminated by signal SIGABRT (Abort)

--- --- --- --- --- 
#include <string>

class Error {
public:
  explicit inline Error(const std::string &str) noexcept {}
};

std::string _cxx_strfmt() noexcept { return std::string(); }

int main(int argc, char **argv) {
  try {
    throw Error(_cxx_strfmt());
  } catch (...) {}
}
------

compiled using 
clang++ -std=c++11  exc.cpp

I attach the llvm ir generate with noexcept (exc-crash.s) and the one without
(exc.s)

-- 
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