Created attachment 21280 [details] Stacktrace for Clang svn 347735 and 350161 Step to Produce: 1. Install latest Visual Studio 2017 15.9.4 and Windows 10 SDK 10.0.17763.0 2. Install LLVM for Visual Studio from https://github.com/zufuliu/llvm-utils/releases, using LLVM_VS2017.zip. This MSBuild source code is very similar to source in http://llvm.org/svn/llvm-project/llvm/trunk/tools/msbuild, except I added ARM64 support (and other small changes): <AdditionalOptions Condition="'$(Platform)' == 'ARM64'">--target=aarch64-pc-windows-msvc $(ClangClAdditionalOptions) %(AdditionalOptions)</AdditionalOptions> 3. Get source code for https://github.com/zufuliu/notepad2, Open build\VS2017\Notepad2.sln, select LLVMDebug + ARM64 and LLVMRelease + ARM64 to build both project, result: LLVMDebug + ARM64 LLVMRelease + ARM64 metapath OK OK Notepad2 OK Clang Crashed for both c++17 and c++2a Host Windows 10 x64 Pro 1803 v10.0.17134.472 on i5-4570. Detail stacktrace ("/showFilenames -v" is added to LLVM -> Additional Compiler Options) for c++2a (c++17 is very similar) is in attachment. SVN r347735 from http://llvm.org/builds/: 1>Assertion failed: Subtarget.isCallingConvWin64(MF.getFunction().getCallingConv()) && "Funclets should only be present on Win64", file C:\src\llvm_package_347735\llvm\lib\Target\AArch64\AArch64FrameLowering.cpp, line 1506 Self build 350161 trunk: 1>Assertion failed: unsigned(ObjectIdx+NumFixedObjects) < Objects.size() && "Invalid Object Idx!", file H:\llvm\llvm\include\llvm/CodeGen/MachineFrameInfo.h, line 489
Has this been fixed since the latest work on Win ARM64 EH?
The "isCallingConvWin64" assertion should be fixed. I don't recall ever seeing the other one.
Thanks for looking on this, I will build clang from GitHub source with Visual Studio 2017 15.9.7 tomorrow, and test if it working.
Still fail (build from llvm-svn: 354719, git commit: 6ac16e91f6dff44cfdd3fc4092a06ea383670c5c): Assertion failed: unsigned(ObjectIdx+NumFixedObjects) < Objects.size() && "Invalid Object Idx!", file H:\llvm\llvm\llvm\include\llvm/CodeGen/MachineFrameInfo.h, line 488 which point to: int64_t getObjectSize(int ObjectIdx) const { assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() && "Invalid Object Idx!"); return Objects[ObjectIdx+NumFixedObjects].Size; }
Normally when clang crashes, it generates two files: one with preprocessed source, and one with the invocation, and indicates where they are on stderr. If they are there, can you attach those? Not sure off the top of my head if it works with clang-cl, but I would be sort of surprised if it doesn't. (If it doesn't work, that's something we should probably fix.) If that isn't working for some reason, can you generate preprocessed source for the file in question by passing /P?
Created attachment 21514 [details] Preprocessed sources and associated run script Preprocessed sources and associated run script by building notepad2 with `-v /showFilenames`, not `/P` (which cause link error).
The error (llvm-svn: 354849, git: c6d54ae9daad8fbcf26bbff2be6844bf05c19f6e): 1>Assertion failed: unsigned(ObjectIdx+NumFixedObjects) < Objects.size() && "Invalid Object Idx!", file H:\llvm\llvm\llvm\include\llvm/CodeGen/MachineFrameInfo.h, line 488 1>clang-cl: error: clang frontend command failed due to signal (use -v to see invocation) 1>clang version 9.0.0 (https://github.com/llvm/llvm-project.git c6d54ae9daad8fbcf26bbff2be6844bf05c19f6e) 1>Target: aarch64-pc-windows-msvc 1>Thread model: posix 1>InstalledDir: F:\Dev\LLVM\bin Due to upload limitation (1000K), other preprocessed sources (total 182MB) not included in the attachment. Maybe you can build notepad2 (3-Clause BSD) yourself to get these files (see "Step to Produce" at the beginning of this bug report).
Hmm, strange build system; usually it doesn't pass a bunch of files to the compiler at the same time. It looks like from your stacktrace the one that's actually crashing is PlatWin.cxx?
Created attachment 21515 [details] Preprocessed source for Editor.cxx Preprocessed source for Editor.cxx as this is the last file from build command.
I think there is some bug in the optimizer. The project build successfully when optimization is disabled (/Od, or <Optimization>Disabled</Optimization>) in debug and release mode. Crashed only when optimization is enabled. /Od
(In reply to Zufu Liu from comment #10) > I think there is some bug in the optimizer. > The project build successfully when optimization is disabled (/Od, or > <Optimization>Disabled</Optimization>) in debug and release mode. Crashed > only when optimization is enabled. > /Od Crashed in both debug and release mode when optimization is enabled. /O1 <Optimization>MinSpace</Optimization> /O2 <Optimization>MaxSpeed</Optimization> /Os <FavorSizeOrSpeed>Size</FavorSizeOrSpeed> /Ot <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
Okay, I can reproduce with that. Looks like a recent regression.
I think I found the problem. Reduced testcase: void g(); void f(int x) { try { if (x!=0) g(); } catch (...) { } } I don't think it's a regression from the initial AArch64 EH patches; not sure why we haven't run into this before.
https://reviews.llvm.org/D58752
(In reply to Eli Friedman from comment #14) > https://reviews.llvm.org/D58752 Thanks, with patch at D58752 clang not crashed.
Merged to trunk.