[llvm-bugs] [Bug 52233] New: clang crashes when mixing SEH and objc exceptions in a single function

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 20 08:03:14 PDT 2021


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

            Bug ID: 52233
           Summary: clang crashes when mixing SEH and objc exceptions in a
                    single function
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

% 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 https://bugs.llvm.org/ 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.

-- 
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/20211020/ae8d7564/attachment.html>


More information about the llvm-bugs mailing list