Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

clang-cl coroutines crashed when exceptions are used with suspend_always from initial_suspend #44250

Open Quuxplusone opened 4 years ago

Quuxplusone commented 4 years ago
Bugzilla Link PR45280
Status CONFIRMED
Importance P enhancement
Reported by Yousef Eissa (upplusloader@gmail.com)
Reported on 2020-03-23 04:31:57 -0700
Last modified on 2020-03-25 11:13:46 -0700
Version 9.0
Hardware PC Windows NT
CC htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, rnk@google.com
Fixed by commit(s)
Attachments attachments.zip (342982 bytes, application/x-zip-compressed)
Blocks
Blocked by
See also
Created attachment 23273
source files and processed source files and run scripts

clang-cl (tested 8 and 9) encounter a backend crash while compiling a coroutine
that uses try catch blocks and the promise_type has an initial_suspend method
which returns suspend_always .

if  initial_suspend method returns  suspend_never no crash !
if no exceptions are used in the coroutine no crash !

sample files are attached and files asked to be attached in the output .

compilation command : clang-cl -Xclang -v -Xclang -fcoroutines-ts test-
clang.cpp /EHsc

output :

clang -cc1 version 9.0.0 based upon LLVM 9.0.0-r363781 default target x86_64-pc-
windows-msvc
#include "..." search starts here:
#include <...> search starts here:
 C:\Program Files\LLVM\lib\clang\9.0.0\include
 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\include
 C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt
 C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared
 C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um
 C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt
End of search list.
Instruction does not dominate all uses!
  %ex.reload.addr = getelementptr inbounds %"?coro2@@YA?AUTask@@V?$vector@HV?$allocator@H@std@@@std@@@Z.Frame", %"?coro2@@YA?AUTask@@V?$vector@HV?$allocator@H@std@@@std@@@Z.Frame"* %FramePtr, i32 0, i32 9
  %10 = catchpad within %9 [%rtti.TypeDescriptor19* @"??_R0?AVexception@std@@@8", i32 8, %"class.std::exception"** %ex.reload.addr]
in function ?coro2@@YA?AUTask@@V?$vector@HV?$allocator@H@std@@@std@@@Z
fatal error: error in backend: Broken function found, compilation aborted!
Stack dump:
0.      Program arguments: C:\Program Files\LLVM\bin\clang-cl.exe -cc1 -triple
x86_64-pc-windows-msvc19.25.28610 -emit-obj -mrelax-all -mincremental-linker-
compatible -disable-free -main-file-name test-clang.cpp -mrelocation-model pic -
pic-level 2 -mthread-model posix -relaxed-aliasing -fmath-errno -masm-verbose -
mconstructor-aliases -munwind-tables -target-cpu x86-64 -mllvm -x86-asm-
syntax=intel -D_MT -flto-visibility-public-std --dependent-lib=libcmt --
dependent-lib=oldnames -stack-protector 2 -fcxx-exceptions -fexceptions -
fexternc-nounwind -fms-volatile -fdiagnostics-format msvc -dwarf-column-info -
momit-leaf-frame-pointer -resource-dir C:\Program Files\LLVM\lib\clang\9.0.0 -
internal-isystem C:\Program Files\LLVM\lib\clang\9.0.0\include -internal-
isystem C:\Program Files (x86)\Microsoft Visual
Studio\2019\Community\VC\Tools\MSVC\14.25.28610\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
E:\programs\projects\rad-lib\build\rad-lib.dir -ferror-limit 19 -fmessage-
length 150 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-
compatibility-version=19.25.28610 -std=c++14 -fdelayed-template-parsing -fobjc-
runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -v -fcoroutines-ts -
faddrsig -o C:\Users\userpc\AppData\Local\Temp\test-clang-90f8b1.obj -x c++
test-clang.cpp
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'CallGraph Pass Manager' on module 'test-clang.cpp'.
4.      Running pass 'Module Verifier' on function
'@"?coro2@@YA?AUTask@@V?$vector@HV?$allocator@H@std@@@std@@@Z"'
clang-cl: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 9.0.0 (trunk)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
clang-cl: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-cl: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-cl: note: diagnostic msg: C:\Users\userpc\AppData\Local\Temp\test-clang-
feb6dd.cpp
clang-cl: note: diagnostic msg: C:\Users\userpc\AppData\Local\Temp\test-clang-
feb6dd.sh
clang-cl: note: diagnostic msg:

********************
Quuxplusone commented 4 years ago

Attached attachments.zip (342982 bytes, application/x-zip-compressed): source files and processed source files and run scripts

Quuxplusone commented 4 years ago

I believe there has never been an effort to make clang-cl support coroutines, so this is expected, and I don't expect the issue to be addressed soon.

Quuxplusone commented 4 years ago

Downloaded clang 10 now and I can no longer reproduce the problem . It was solved !

Quuxplusone commented 4 years ago

However another big issue has occured . clang 10 has partial concepts cuspport but doesn't support the standard library concepts yet and the concepts header in visual studio stl emits errors for clang when c++20 is enabled so clang is now unusable on windows if c++20 is enabled ! it was possible to use the supported features before but now I have to turn off all c++20 support in order to compile most basic programs !

Quuxplusone commented 4 years ago
(In reply to Yousef Eissa from comment #3)
> However another big issue has occured . clang 10 has partial concepts
> cuspport but doesn't support the standard library concepts yet and the
> concepts header in visual studio stl emits errors for clang when c++20 is
> enabled so clang is now unusable on windows if c++20 is enabled ! it was
> possible to use the supported features before but now I have to turn off all
> c++20 support in order to compile most basic programs !

I think this is https://llvm.org/pr44956, and you can see a response from Casey
Carter in this comment:
https://bugs.llvm.org/show_bug.cgi?id=44956#c9