https://llvm.org/bugs/show_bug.cgi?id=26036
Bug ID: 26036 Summary: [WinEH] bad codegen when calling printf in catch and building with optimizations Product: clang Version: trunk Hardware: PC OS: Windows NT Status: NEW Severity: normal Priority: P Component: -New Bugs Assignee: unassignedclangb...@nondot.org Reporter: r.sagita...@gmx.de CC: llvm-bugs@lists.llvm.org Classification: Unclassified #include <stdio.h> int main(int argc, char** argv) { try { throw int(8); } catch (int o) { printf("caught\n"); } return 0; } Compiling this with "clang -m32 -fexceptions -O" creates a crashing executable. This is caused by the LibCallSimplifier pass replacing printf with puts, but dropping the "funclet" token: [...] catch.dispatch.i: ; preds = %entry %2 = catchswitch within none [label %catch.i] unwind to caller catch.i: ; preds = %catch.dispatch.i %3 = catchpad within %2 [%rtti.TypeDescriptor2* @"\01??_R0H@8", i32 0, i32* %o.i] %puts.i = call i32 @puts(i8* nonnull getelementptr inbounds ([7 x i8], [7 x i8]* @str, i32 0, i32 0)) catchret from %3 to label %"\01?test56@@YAXXZ.exit" [...] This generates an incomplete funclet for the catch: "?catch$2@?0??main@@YAXXZ@4HA": LBB1_2: # %catch pushl %ebp subl $8, %esp addl $12, %ebp movl %esp, -28(%ebp) Lfunc_end0: You can disable replacements by setting the NoBuiltin attribute on the printf function call, but that's not ideal. -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs