<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - clang crashes when mixing SEH and objc exceptions in a single function"
   href="https://bugs.llvm.org/show_bug.cgi?id=52233">52233</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crashes when mixing SEH and objc exceptions in a single function
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>LLVM Codegen
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nicolasweber@gmx.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>% cat test.mm
void g();
void f() {
  __try {
    g();
  } __finally {
  }
  @try {
    g();
  } @catch(...) {
    return;
  }

}

% out/gn/bin/clang -c test.mm -O2 -emit-llvm -S -o -  -fms-extensions
--target=x86_64-pc-windows
Assertion failed: (i_nocapture < OperandTraits<FuncletPadInst>::operands(this)
&& "setOperand() out of range!"), function setOperand, file
../../llvm/include/llvm/IR/InstrTypes.h, line 2359.
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: out/gn/bin/clang -c test.mm -O2 -emit-llvm -S -o -
-fms-extensions --target=x86_64-pc-windows
1.      <eof> parser at end of file
2.      test.mm:2:6: LLVM IR generation of declaration 'f'
3.      test.mm:2:6: Generating code for declaration 'f'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH
or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  clang                    0x000000010606e81b
llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 43
1  clang                    0x000000010606d558 llvm::sys::RunSignalHandlers() +
248
2  clang                    0x000000010606dbc0
llvm::sys::CleanupOnSignal(unsigned long) + 208
3  clang                    0x0000000105fe4a9a (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) + 106
4  clang                    0x0000000105fe4c8e CrashRecoverySignalHandler(int)
+ 110
5  libsystem_platform.dylib 0x00007fff6a2d55fd _sigtramp + 29
6  clang                    0x000000010a64f624 AvailabilityVersionCheck +
533020
7  libsystem_c.dylib        0x00007fff6a1ab808 abort + 120
8  libsystem_c.dylib        0x00007fff6a1aaac6 err + 0
9  clang                    0x00000001050c97aa
clang::CodeGen::CGObjCRuntime::EmitTryCatchStmt(clang::CodeGen::CodeGenFunction&,
clang::ObjCAtTryStmt const&, llvm::FunctionCallee, llvm::FunctionCallee,
llvm::FunctionCallee) + 3530
10 clang                    0x00000001050d4117 (anonymous
namespace)::CGObjCGNU::EmitTryStmt(clang::CodeGen::CodeGenFunction&,
clang::ObjCAtTryStmt const&) + 471
11 clang                    0x0000000104e5ac60
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot) + 512
12 clang                    0x000000010504dc03
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 1587
13 clang                    0x0000000105150a9b
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) + 443
14 clang                    0x0000000105149328
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) + 488
15 clang                    0x000000010514d2c5
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 1237
16 clang                    0x000000010515500b
clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 2603
17 clang                    0x000000010558315f (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) + 159
18 clang                    0x000000010558b0f5
clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) + 181
19 clang                    0x0000000106f809c7 clang::ParseAST(clang::Sema&,
bool, bool) + 775
20 clang                    0x00000001054d3d53 clang::FrontendAction::Execute()
+ 99
21 clang                    0x000000010544269f
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 847
22 clang                    0x00000001055afce8
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 552
23 clang                    0x0000000104d122b1 cc1_main(llvm::ArrayRef<char
const*>, char const*, void*) + 2065



I doubt anyone does this in practice. I noticed it while fooling around.

The frontend rejects mixing C++ exceptions and SEH exceptions. We should
probably reject mixing Obj-C exceptions and SEH exceptions as well.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>