[llvm-bugs] [Bug 44372] New: ClangCl: windows structured exception handling doesn't work
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Dec 24 03:13:05 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=44372
Bug ID: 44372
Summary: ClangCl: windows structured exception handling doesn't
work
Product: clang
Version: 9.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: andrii.riabushenko at barclays.com
CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at metafoo.co.uk
Example compiles with Clang-Cl from official LLVM 9.0 64bit windows binaries
but crashes at the runtime.
Example taken from
https://docs.microsoft.com/en-us/cpp/cpp/try-except-statement?view=vs-2019.
#include <stdio.h>
#include <windows.h>
#include <excpt.h>
int filter(unsigned int code, struct _EXCEPTION_POINTERS *ep)
{
puts("in filter.");
if (code == EXCEPTION_ACCESS_VIOLATION)
{
puts("caught AV as expected.");
return EXCEPTION_EXECUTE_HANDLER;
}
else
{
puts("didn't catch AV, unexpected.");
return EXCEPTION_CONTINUE_SEARCH;
};
}
int main()
{
int* p = 0x00000000; // pointer to NULL
puts("hello");
__try
{
puts("in try");
__try
{
puts("in try");
*p = 13; // causes an access violation exception;
}
__finally
{
puts("in finally");
}
}
__except(filter(GetExceptionCode(), GetExceptionInformation()))
{
puts("in except");
}
puts("world");
}
The expected output:
hello
in try
in try
in filter.
caught AV as expected.
in finally
in except
world
The actual output:
hello
in try
in try
(CRASH)
--
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/20191224/7be6cbb4/attachment-0001.html>
More information about the llvm-bugs
mailing list