[llvm-bugs] [Bug 46715] New: Windows x64 SEH break inside of __finally leads to crash
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jul 14 06:50:51 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46715
Bug ID: 46715
Summary: Windows x64 SEH break inside of __finally leads to
crash
Product: clang
Version: 10.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: bwittman at gmail.com
CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at metafoo.co.uk
When using a break inside of a __finally, clang correctly gives a warning:
warning: jump out of __finally block has undefined behavior
[-Wjump-seh-finally]
However, it can crash with a signal. I believe this bug is related to Bug
26822, but the crash is more severe. Curiously, not all usages of break cause
this crash.
Sample code:
#include <windows.h>
#include <iostream>
using namespace std;
int main() {
int value;
for(int i = 0; i < 5; ++i) {
cout << "Enter value: ";
cin >> value;
__try {
if(value > 10)
RaiseException( STATUS_INTEGER_DIVIDE_BY_ZERO,
0, 0, 0);
}
__finally {
break;
}
}
return 0;
}
Stack dump:
0. Program arguments: C:\Program Files\LLVM\bin\clang++.exe -cc1 -triple
x86_64-pc-windows-msvc19.23.28105 -emit-obj -mrelax-all
-mincremental-linker-compatible -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name crazy3.cpp -mrelocation-model pic
-pic-level 2 -mthread-model posix -mframe-pointer=none -fmath-errno
-fno-rounding-math -masm-verbose -mconstructor-aliases -munwind-tables
-target-cpu x86-64 -dwarf-column-info -resource-dir C:\Program
Files\LLVM\lib\clang\10.0.0 -internal-isystem C:\Program
Files\LLVM\lib\clang\10.0.0\include -internal-isystem C:\Program Files
(x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\include
-internal-isystem C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.23.28105\atlmfc\include
-internal-isystem C:\Program Files (x86)\Windows
Kits\10\Include\10.0.18362.0\ucrt -internal-isystem C:\Program Files
(x86)\Windows Kits\10\include\10.0.18362.0\shared -internal-isystem C:\Program
Files (x86)\Windows Kits\10\include\10.0.18362.0\um -internal-isystem
C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt
-fdeprecated-macro -fdebug-compilation-dir C:\Users\Barry Wittman\Desktop\C++
testing -ferror-limit 19 -fmessage-length 120 -fno-use-cxa-atexit
-fms-extensions -fms-compatibility -fms-compatibility-version=19.23.28105
-std=c++14 -fdelayed-template-parsing -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -faddrsig -o
C:\Users\BARRYW~1\AppData\Local\Temp\crazy3-a12283.o -x c++ crazy3.cpp
1. <eof> parser at end of file
2. crazy3.cpp:6:5: LLVM IR generation of declaration 'main'
3. crazy3.cpp:6:5: Generating code for declaration 'main'
4. crazy3.cpp:8:29: LLVM IR generation of compound statement ('{}')
5. crazy3.cpp:15:14: LLVM IR generation of compound statement ('{}')
#0 0x00007ff604cddc00 C:\Program Files\LLVM\bin\clang++.exe 0x118dc00
C:\Program Files\LLVM\bin\clang++.exe 0x11bf05e
#1 0x00007ff604cddc00 C:\Program Files\LLVM\bin\clang++.exe 0x1b6cbae
C:\Program Files\LLVM\bin\clang++.exe 0x1b43249
#2 0x00007ff604cddc00 C:\Program Files\LLVM\bin\clang++.exe 0x1b4266f
C:\Program Files\LLVM\bin\clang++.exe 0x1b4c1a0
#3 0x00007ff604cddc00 C:\Program Files\LLVM\bin\clang++.exe 0x1b4b8fb
C:\Program Files\LLVM\bin\clang++.exe 0x1b431c6
#4 0x00007ff604cddc00 C:\Program Files\LLVM\bin\clang++.exe 0x1b4266f
C:\Program Files\LLVM\bin\clang++.exe 0x1a5fc06
#5 0x00007ff604cddc00 C:\Program Files\LLVM\bin\clang++.exe 0x1a5fa29
C:\Program Files\LLVM\bin\clang++.exe 0x1b42c9f
#6 0x00007ff604cddc00 C:\Program Files\LLVM\bin\clang++.exe 0x1b4c1a0
C:\Program Files\LLVM\bin\clang++.exe 0x1b4b8fb
#7 0x00007ff604cddc00 C:\Program Files\LLVM\bin\clang++.exe 0x1b431c6
C:\Program Files\LLVM\bin\clang++.exe 0x1b4266f
#8 0x00007ff604cddc00 C:\Program Files\LLVM\bin\clang++.exe 0x1b4566f
C:\Program Files\LLVM\bin\clang++.exe 0x1b428cf
#9 0x00007ff604cddc00 C:\Program Files\LLVM\bin\clang++.exe 0x1b4c1a0
C:\Program Files\LLVM\bin\clang++.exe 0x1a2047e
#10 0x00007ff604cddc00 C:\Program Files\LLVM\bin\clang++.exe 0x1a20d73
C:\Program Files\LLVM\bin\clang++.exe 0x189bc4e
#11 0x00007ff604cddc00 C:\Program Files\LLVM\bin\clang++.exe 0x1894f97
C:\Program Files\LLVM\bin\clang++.exe 0x1898ad3
#12 0x00007ff604cddc00 C:\Program Files\LLVM\bin\clang++.exe 0x189eca3
C:\Program Files\LLVM\bin\clang++.exe 0x36ad64f
#13 0x00007ff604cddc00 C:\Program Files\LLVM\bin\clang++.exe 0x36ab439
C:\Program Files\LLVM\bin\clang++.exe 0x2889845
#14 0x00007ff604cddc00 C:\Program Files\LLVM\bin\clang++.exe 0x1dadb02
C:\Program Files\LLVM\bin\clang++.exe 0x1d70bc0
#15 0x00007ff604cddc00 C:\Program Files\LLVM\bin\clang++.exe 0x1e08ca9
C:\Program Files\LLVM\bin\clang++.exe 0x6ebf
#16 0x00007ff604cddc00 C:\Program Files\LLVM\bin\clang++.exe 0x4337 C:\Program
Files\LLVM\bin\clang++.exe 0x4014
#17 0x00007ff604cddc00 C:\Program Files\LLVM\bin\clang++.exe 0x36c74a0
(C:\Program Files\LLVM\bin\clang++.exe+0x118dc00)
#18 0x00007ff604cddc00
#19 0x00007ff604cddc00 (C:\Program Files\LLVM\bin\clang++.exe+0x118dc00)
0x00007FF604CDDC00 (0x0000000069780105 0x0000001069788500 0x0000000000000018
0x00007FF604CEF2FF)
0x00007FF604D0F05E (0x000001A67B7493B0 0x0000000000000000 0x0000002269788440
0x0000000000000002)
0x00007FF6056BCBAE (0x0000000000000000 0x0000000000000000 0xFFFFFFFFFFFFFFF8
0x0000D76161E96926)
0x00007FF605693249 (0x0000002269788440 0x0000D76161E969C6 0x000000226978AAA0
0x0000002269788980)
0x00007FF60569266F (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x000001A676880000)
0x00007FF60569C1A0 (0x0000000000000000 0x0000D76161E96E66 0x0000000000000000
0x0000000000000000)
0x00007FF60569B8FB (0x000000000000000F 0x0000002269788758 0x0000001000000002
0x000001A67B927AF8)
0x00007FF6056931C6 (0x0040406E69616D40 0x0000D76161E96DD6 0x0000002269788810
0x0000D76161E96856)
0x00007FF60569266F (0x0000000000000000 0x0000000000000000 0x000000000000009A
0x00000000FFFFFFFF)
0x00007FF6055AFC06 (0x0000000000000068 0x0000002400000000 0x0000000000000000
0x000001A676981440)
0x00007FF6055AFA29 (0x0000000000000080 0x0000D76100000000 0x0000000000000000
0x0000000000000000)
0x00007FF605692C9F (0x00007FF4DFD70000 0x0000000000000000 0x0000000000000000
0x00007FFD30F5F48D)
0x00007FF60569C1A0 (0x00007FFD00000000 0x000000226978A170 0x000000226978A1D0
0x000000226978A120)
0x00007FF60569B8FB (0x000000226978A460 0x000000226978AAA0 0x000001A67B7484C8
0x00007FF6057297C6)
0x00007FF6056931C6 (0x000001A67B0EFC30 0x000001A67B0EFBD0 0x000001A67B0EFC90
0x00007FF604D00288)
0x00007FF60569266F (0x000001A67B8F4170 0x000001A67B0EF6A8 0x0000000000000004
0x0000D76161E94876)
0x00007FF60569566F (0x000001A67B777890 0x00007FF606C458A4 0x000001A67B8F40B8
0x0000000000000000)
0x00007FF6056928CF (0x000000226978A738 0x0000000000000001 0x000001A676959E70
0x000001A67B8F40B8)
0x00007FF60569C1A0 (0x000001A67B8F40B8 0x00007FF6055B3C45 0x000001A67B0EF8D0
0x0000000000000046)
0x00007FF60557047E (0x000001A67B8F4000 0x000001A600000016 0x0000D76161E94206
0x000000226978AA40)
0x00007FF605570D73 (0x0000D76161E94356 0x00007FF6053AD68E 0x0000000000000015
0x000001A676A84C20)
0x00007FF6053EBC4E (0x0000000000000000 0xFFFFFFFFFFFFFFFF 0x0000000000000000
0xFFFFFFFFFFFFFFFF)
0x00007FF6053E4F97 (0x000001A676A85E10 0x000000226978CA68 0x0000002200000059
0x0000000000000000)
0x00007FF6053E8AD3 (0x0000000000000000 0x00007FF60684F59B 0x0000000000000000
0x0000D76161E95786)
0x00007FF6053EECA3 (0x0000000000000000 0x000001A676A84C30 0x0000000000000000
0x000000226978D8F0)
0x00007FF6071FD64F (0x000001A676A84C20 0x0000000000000000 0x000001A676A84C20
0x000001A67B8F40B8)
0x00007FF6071FB439 (0x000000226978D9F8 0x000000226978DA08 0x000000226978DA38
0x00007FF6058BDD5A)
0x00007FF6063D9845 (0x000000010000000E 0x0000D76161E93F36 0x0000000000000000
0x000000000000000F)
0x00007FF6058FDB02 (0x000001A6768C72A0 0x00007FF607217283 0x00000000000000C8
0x0000003100000000)
0x00007FF6058C0BC0 (0x0000000000000001 0x0000000000000000 0x0000000000000246
0x0000000000000000)
0x00007FF605958CA9 (0x0000000000000001 0x0000000000000010 0x0000000000000045
0x000001A6768C5630)
0x00007FF603B56EBF (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x00007FFD535439FE)
0x00007FF603B54337 (0x000001A69E00009E 0x00000000000000CB 0x00000000000000E8
0x000001A676888C62)
0x00007FF603B54014 (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000)
0x00007FF6072174A0 (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000)
0x00007FFD54887BD4 (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)
0x00007FFD555ECE51 (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)
clang++: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 10.0.0
Target: x86_64-pc-windows-msvc
Thread model: posix
--
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/20200714/1cd9f043/attachment-0001.html>
More information about the llvm-bugs
mailing list