Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

clang: crash when using throw() and nested classes #39983

Open Quuxplusone opened 5 years ago

Quuxplusone commented 5 years ago
Bugzilla Link PR41013
Status NEW
Importance P normal
Reported by Mathias Berchtold (mberchtold@gmail.com)
Reported on 2019-03-08 06:12:06 -0800
Last modified on 2019-03-08 11:05:00 -0800
Version trunk
Hardware PC All
CC htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk, rnk@google.com
Fixed by commit(s)
Attachments llvmcrash1-6e336f.cpp (388 bytes, text/plain)
llvmcrash1-6e336f.sh (4736 bytes, text/x-sh)
Blocks
Blocked by
See also
Created attachment 21577
example

When compiling the attached minimal reproducible example, clang crashes with
this error message:

Assertion failed: S.DelayedOverridingExceptionSpecChecks.empty() && "there
shouldn't be any pending delayed exception spec checks", file
C:\src\llvm_package_355397\llvm\tools\clang\include\clang/Sema/Sema.h, line
10940

Stack dump:
0.  Program arguments: C:\Program Files\LLVM\bin\clang++.exe -cc1 -triple i386-
pc-windows-msvc19.20.0 -fsyntax-only -disable-free -main-file-name
llvmcrash1.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -target-cpu pentium4 -dwarf-
column-info -resource-dir C:\Program Files\LLVM\lib\clang\9.0.0 -isystem
C:\Projects\Libraries\wtl\wtl\include -isystem
C:\Projects\Common\scintilla\include -isystem
C:\Projects\Libraries\openssl\openssl\include -isystem
C:\Projects\Libraries\boost\boost -isystem C:\Projects\Common\krb5 -isystem
C:\Projects\Libraries\networking-ts\networking-ts-impl\include -isystem
C:\Program Files (x86)\Microsoft Visual
Studio\2019\Preview\VC\Tools\MSVC\14.20.27404\include -isystem C:\Program Files
(x86)\Microsoft Visual
Studio\2019\Preview\VC\Tools\MSVC\14.20.27404\atlmfc\include -isystem
C:\Program Files (x86)\Windows Kits\10\Include\10.0\ucrt -isystem C:\Program
Files (x86)\Windows Kits\10\Include\10.0\um -isystem C:\Program Files
(x86)\Windows Kits\10\Include\10.0\shared -isystem C:\Program Files
(x86)\Windows Kits\10\Include\10.0\winrt -isystem C:\Program Files
(x86)\Windows Kits\10\Include\10.0\cppwinrt -D WIN32 -D _DEBUG -D _CONSOLE -D
UNICODE -D _UNICODE -internal-isystem C:\Program
Files\LLVM\lib\clang\9.0.0\include -internal-isystem C:\Program Files
(x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.20.27404\include -
internal-isystem C:\Program Files (x86)\Windows
Kits\10\Include\10.0.17763.0\ucrt -internal-isystem C:\Program Files
(x86)\Windows Kits\10\include\10.0.17763.0\shared -internal-isystem C:\Program
Files (x86)\Windows Kits\10\include\10.0.17763.0\um -internal-isystem
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt -Wall -
Wmicrosoft -Wno-invalid-token-paste -Wno-unknown-pragmas -Wno-unused-value -
std=c++14 -fdeprecated-macro -fdebug-compilation-dir
C:\Projects\Others\llvmcrash1 -ferror-limit 19 -fmessage-length 0 -fno-use-cxa-
atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.20 -
fdelayed-template-parsing -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -
fdiagnostics-show-option -x c++ C:\Projects\Others\llvmcrash1\llvmcrash1.cpp -
faddrsig
1.  C:\Projects\Others\llvmcrash1\llvmcrash1.cpp:20:39: current parser token ';'
2.  C:\Projects\Others\llvmcrash1\llvmcrash1.cpp:11:1: parsing
struct/union/class body 'A'
3.  C:\Projects\Others\llvmcrash1\llvmcrash1.cpp:2:7: instantiating class
definition 'Implementation<A::AbstractInner>'
0x00007FF78EA184E6 (0x0000000000000016 0x00007FF78EA184E0 0x000000F600000000
0x00007FFF7D2DA510)
0x00007FFF7D25DA2D (0x0000000000002A01 0x00007FF700000000 0x0000000000002ABC
0x00007FF79205145A), raise() + 0x1DD bytes(s)
0x00007FFF7D25E901 (0x00007FFF00000003 0x00007FFF00000003 0x00007FF79205145A
0x00007FF792013010), abort() + 0x31 bytes(s)
0x00007FFF7D260261 (0x0000000000002ABC 0x00007FF79205145A 0x000000F6D8D8AE10
0x00007FF79060D29E), _get_wpgmptr() + 0x18A1 bytes(s)
0x00007FFF7D260591 (0x000000F6D8D8A700 0x000000F6D8D8AA00 0x000000F6D8D8AA40
0x000002C6073EA010), _wassert() + 0x71 bytes(s)
0x00007FF79053F4DE (0x0000000010288202 0x000000F6D8D8A9C0 0x00000001073E9900
0x0000000000000000)
0x00007FF79053F091 (0x000002C6073EA010 0x000002C6070C1C10 0x000000F6D8D8AE30
0x00007FF79017EEC5)
0x00007FF790541185 (0x000002C6073E0000 0x000002C6073EA110 0x000002C6070C4470
0x000000F6D8D8C5F0)
0x00007FF79044FE9B (0x000002C6073EA110 0x000000F6D8D8BD90 0x0000000000000000
0x000002C6073EA110)
0x00007FF79044F7A1 (0x000002C6070C1C10 0x00007FF7907D32F8 0x000002C6073EA0F0
0x000002C600000000)
0x00007FF79043B370 (0x000000000000003E 0x000000F6D8D8BD90 0x0000000000000000
0x0000000000000003)
0x00007FF790134548 (0x0000FED146F89350 0x000002C6070C4470 0x0000000000000005
0x000002C6070C4470)
0x00007FF790134385 (0x0000000200000005 0x000000F6D8D8C920 0x000000F6D8D8C620
0x000002C6070C47D0)
0x00007FF79002276B (0x000000F6D8D8BB20 0x00007FF790037C20 0x000002C6070C59B0
0x00007FF78FFD516B)
0x00007FF78FEAE229 (0x000002C6073E9738 0x000002C600000076 0x000002C60000007C
0x000002C6073E4D58)
0x00007FF78FEB048D (0x000002C6070A1380 0x000002C6073E4C98 0x000000F6D8D8D048
0x0000000000000000)
0x00007FF78FEAA8CB (0x0000000000000000 0x0000000000000000 0x000002C6070BD7F0
0x00007FF79221CBFF)
0x00007FF78FEA83C4 (0x000002C607040000 0x000000F600000002 0x00000000000001B0
0x00007FF78FFD5AFC)
0x00007FF78FEC25C2 (0x000000F6D8D8D5B0 0x0000000400000001 0x000002C6070BE6B8
0x00007FF790B2341C)
0x00007FF78FE7C035 (0x000002C6070A1190 0x00007FF790D76DEC 0x0000000000000000
0x000002C6070A1540)
0x00007FF78FE7BC20 (0x000002C6070C4470 0x00007FF79200FA1D 0x0000000000000000
0x00007FF790B1A578)
0x00007FF78FE7A5A6 (0x000000F6D8D8F8C0 0x000000F6D8D8DB40 0x000002C6070C4470
0x00007FF790D77600)
0x00007FF78FE79235 (0x0000000000000048 0x00007FFF00000000 0x000002C6070C94A3
0x000000000000000C)
0x00007FF78FE752D6 (0x0000000000000000 0x0000000000000000 0x000002C60708BDD0
0x000002C6070C6600)
0x00007FF78F1B5B90 (0x0000000000000048 0x000002C607092B80 0x000002C607092DA0
0x0000000000000002)
0x00007FF78F17219F (0x000002C60706B501 0x0000000000000000 0x0000000000000000
0x000000000000005D)
0x00007FF78F214E25 (0x000002C607040000 0x0000000000800003 0x0000000000001000
0x0000000000001010)
0x00007FF78CE273C7 (0x00000000000006A6 0x0000000000000000 0x0000000008000008
0x00000000000006B0)
0x00007FF78CE247B8 (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000)
0x00007FF790D73568 (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000)
0x00007FFF809D81F4 (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000), BaseThreadInitThunk() + 0x14 bytes(s)
0x00007FFF80B1A251 (0x0000000000000000 0x0000000000000000 0x0000000000000000
0x0000000000000000), RtlUserThreadStart() + 0x21 bytes(s)
clang++: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 9.0.0 (trunk)
Target: i386-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin
Configuration file: C:\Users\mb\AppData\Local\Temp\tmp1B4E.tmp
clang++: 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++: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++: note: diagnostic msg: C:\Users\mb\AppData\Local\Temp\llvmcrash1-
6e336f.cpp
clang++: note: diagnostic msg: C:\Users\mb\AppData\Local\Temp\llvmcrash1-
6e336f.sh
clang++: note: diagnostic msg:
********************

Code:
template <class Base>
class Implementation :
    public Base
{
public:
    virtual void foo() throw()
    {
    }
};

class A
{
    class AbstractInner
    {
    public:
        // the throw() triggers the crash
        virtual void foo() throw() = 0;
    };

    Implementation<AbstractInner> m_Inner;
};

int main()
{

}

The problem seems to be triggered by throw() and the fact that AbstractInner is
a nested class.
Quuxplusone commented 5 years ago

Attached llvmcrash1-6e336f.cpp (388 bytes, text/plain): example

Quuxplusone commented 5 years ago

Attached llvmcrash1-6e336f.sh (4736 bytes, text/x-sh): shell script

Quuxplusone commented 5 years ago

I was able to repro this with just clang -cc1, no options. This goes back to 8.0.0 at least, so it's not a recent regression.