ualberta-smr / varclang

Mirror of official clang git repository located at http://llvm.org/git/clang. Updated every five minutes.
http://clang.llvm.org/
Other
3 stars 2 forks source link

Failed assertion after error limit reached #54

Open mayshukla opened 5 years ago

mayshukla commented 5 years ago

Example:

// Run this with -ferror-limit=20
#include <istream>

a a;
a a;
a a;
a a;
a a;
a a;
a a;
a a;
a a;
a a;
a a;
a a;
a a;
a a;
a a;
a a;
a a;
a a;
a a;

// Based on bits/locale_facets.tcc
using namespace std;

  template<typename _CharT, typename _InIter>
    _InIter
    time_get<_CharT, _InIter>::
    _M_extract_via_format(iter_type __beg, iter_type __end, ios_base& __io,
              ios_base::iostate& __err, tm* __tm,
              const _CharT* __format) const
    {
      const locale& __loc = __io._M_getloc();
      const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);

      __ctype;

      return __beg;
    }

Note that the repeated a a; declarations are only there to produce a bunch of errors so that the error limit is reached. This assert doesn't fail if the error limit is not reached.

Output:

error_limit.cpp:4:1: error: unknown type name 'a'
a a;
^
error_limit.cpp:5:1: error: unknown type name 'a'
a a;
^
error_limit.cpp:6:1: error: unknown type name 'a'
a a;
^
error_limit.cpp:7:1: error: unknown type name 'a'
a a;
^
error_limit.cpp:8:1: error: unknown type name 'a'
a a;
^
error_limit.cpp:9:1: error: unknown type name 'a'
a a;
^
error_limit.cpp:10:1: error: unknown type name 'a'
a a;
^
error_limit.cpp:11:1: error: unknown type name 'a'
a a;
^
error_limit.cpp:12:1: error: unknown type name 'a'
a a;
^
error_limit.cpp:13:1: error: unknown type name 'a'
a a;
^
error_limit.cpp:14:1: error: unknown type name 'a'
a a;
^
error_limit.cpp:15:1: error: unknown type name 'a'
a a;
^
error_limit.cpp:16:1: error: unknown type name 'a'
a a;
^
error_limit.cpp:17:1: error: unknown type name 'a'
a a;
^
error_limit.cpp:18:1: error: unknown type name 'a'
a a;
^
error_limit.cpp:19:1: error: unknown type name 'a'
a a;
^
error_limit.cpp:20:1: error: unknown type name 'a'
a a;
^
error_limit.cpp:21:1: error: unknown type name 'a'
a a;
^
error_limit.cpp:22:1: error: unknown type name 'a'
a a;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
clang-6.0: /home/ryan/Files/variability-research/llvm/tools/clang/lib/AST/Decl.cpp:2293: bool clang::VarDecl::checkInitIsICE() const: Assertion `!Init->isValueDependent()' failed.
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x46)[0x56343fb23676]
/home/ryan/Files/variability-research/build/bin/clang-6.0(+0x4f5e879)[0x56343fb23879]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN4llvm3sys17RunSignalHandlersEv+0x90)[0x56343fb21c10]
/home/ryan/Files/variability-research/build/bin/clang-6.0(+0x4f5ec6a)[0x56343fb23c6a]
/usr/lib/libpthread.so.0(+0x124d0)[0x7feb9bc914d0]
/usr/lib/libc.so.6(gsignal+0x10f)[0x7feb9b47082f]
/usr/lib/libc.so.6(abort+0x125)[0x7feb9b45b672]
/usr/lib/libc.so.6(+0x22548)[0x7feb9b45b548]
/usr/lib/libc.so.6(+0x2fdb6)[0x7feb9b468db6]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZNK5clang7VarDecl14checkInitIsICEEv+0xec)[0x563443c7a32c]
/home/ryan/Files/variability-research/build/bin/clang-6.0(+0x7f44f15)[0x563442b09f15]
/home/ryan/Files/variability-research/build/bin/clang-6.0(+0x7e7312b)[0x563442a3812b]
/home/ryan/Files/variability-research/build/bin/clang-6.0(+0x7e7355c)[0x563442a3855c]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang4Sema21MarkDeclRefReferencedEPNS_11DeclRefExprEPKNS_4ExprE+0xed)[0x5634429f561d]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang4Sema16BuildDeclRefExprEPNS_9ValueDeclENS_8QualTypeENS_13ExprValueKindERKNS_19DeclarationNameInfoEPKNS_12CXXScopeSpecEPNS_9NamedDeclEPKNS_24TemplateArgumentListInfoE+0x401)[0x5634429f5211]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang4Sema24BuildDeclarationNameExprERKNS_12CXXScopeSpecERKNS_19DeclarationNameInfoEPNS_9NamedDeclES8_PKNS_24TemplateArgumentListInfoEb+0xce6)[0x5634429fa6b6]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang4Sema24BuildDeclarationNameExprERKNS_12CXXScopeSpecERNS_12LookupResultEbb+0xd2)[0x5634429f82a2]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang4Sema12ClassifyNameEPNS_5ScopeERNS_12CXXScopeSpecERPNS_14IdentifierInfoENS_14SourceLocationERKNS_5TokenEbSt10unique_ptrINS_27CorrectionCandidateCallbackESt14default_deleteISD_EE+0x1876)[0x563442619146]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang6Parser15TryAnnotateNameEbSt10unique_ptrINS_27CorrectionCandidateCallbackESt14default_deleteIS2_EE+0x405)[0x563441fea095]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang6Parser42ParseStatementOrDeclarationAfterAttributesERN4llvm11SmallVectorIPNS_4StmtELj32EEENS0_21AllowedConstructsKindEPNS_14SourceLocationERNS0_25ParsedAttributesWithRangeE+0x248)[0x5634420ba638]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang6Parser37SplittableParseStatementOrDeclarationERN4llvm11SmallVectorIPNS_4StmtELj32EEENS0_21AllowedConstructsKindEPNS_14SourceLocationE+0xaa)[0x5634420ba27a]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang6Parser27ParseStatementOrDeclarationERN4llvm11SmallVectorIPNS_4StmtELj32EEENS0_21AllowedConstructsKindEPNS_14SourceLocationE+0x4ad)[0x5634420ba18d]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang6Parser26ParseCompoundStatementBodyEb+0x50d)[0x5634420c2a3d]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang6Parser36SplittableParseFunctionStatementBodyEPNS_4DeclERNS0_10ParseScopeE+0x1f3)[0x5634420c36d3]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang6Parser26ParseFunctionStatementBodyEPNS_4DeclERNS0_10ParseScopeE+0x55)[0x5634420c3875]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang6Parser23ParseFunctionDefinitionERNS_17ParsingDeclaratorERKNS0_18ParsedTemplateInfoEPNS0_18LateParsedAttrListE+0x109e)[0x563441fe90fe]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang6Parser35ParseSingleDeclarationAfterTemplateENS_17DeclaratorContextERKNS0_18ParsedTemplateInfoERNS_21ParsingDeclRAIIObjectERNS_14SourceLocationENS_15AccessSpecifierEPNS_13AttributeListE+0xc1b)[0x5634420f702b]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang6Parser40ParseTemplateDeclarationOrSpecializationENS_17DeclaratorContextERNS_14SourceLocationENS_15AccessSpecifierEPNS_13AttributeListE+0x5ef)[0x5634420f610f]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang6Parser36ParseDeclarationStartingWithTemplateENS_17DeclaratorContextERNS_14SourceLocationENS_15AccessSpecifierEPNS_13AttributeListE+0xff)[0x5634420f599f]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang6Parser16ParseDeclarationENS_17DeclaratorContextERNS_14SourceLocationERNS0_25ParsedAttributesWithRangeE+0x125)[0x56344204f015]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang6Parser24ParseExternalDeclarationERNS0_25ParsedAttributesWithRangeEPNS_15ParsingDeclSpecE+0xb1e)[0x563441fe64fe]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang6Parser17ParseTopLevelDeclERNS_9OpaquePtrINS_12DeclGroupRefEEE+0x462)[0x563441fe5532]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang8ParseASTERNS_4SemaEbb+0x259)[0x563441fd9749]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang17ASTFrontendAction13ExecuteActionEv+0x142)[0x56344092f2a2]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang14FrontendAction7ExecuteEv+0x80)[0x56344092ec80]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang16CompilerInstance13ExecuteActionERNS_14FrontendActionE+0x5a9)[0x563440831849]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_ZN5clang25ExecuteCompilerInvocationEPNS_16CompilerInstanceE+0x7c8)[0x563440ace148]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_Z8cc1_mainN4llvm8ArrayRefIPKcEES2_Pv+0x43c)[0x56343e21bc3c]
/home/ryan/Files/variability-research/build/bin/clang-6.0(+0x364861a)[0x56343e20d61a]
/home/ryan/Files/variability-research/build/bin/clang-6.0(main+0xeca)[0x56343e20c28a]
/usr/lib/libc.so.6(__libc_start_main+0xf3)[0x7feb9b45cce3]
/home/ryan/Files/variability-research/build/bin/clang-6.0(_start+0x2e)[0x56343e20b02e]
Stack dump:
0.  Program arguments: /home/ryan/Files/variability-research/build/bin/clang-6.0 -cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -disable-free -main-file-name error_limit.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -resource-dir /home/ryan/Files/variability-research/build/lib/clang/6.0.1 -internal-isystem /usr/lib64/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../include/c++/8.3.0 -internal-isystem /usr/lib64/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../include/c++/8.3.0/x86_64-pc-linux-gnu -internal-isystem /usr/lib64/gcc/x86_64-pc-linux-gnu/8.3.0/../../../../include/c++/8.3.0/backward -internal-isystem /usr/local/include -internal-isystem /home/ryan/Files/variability-research/build/lib/clang/6.0.1/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /home/ryan/Files/variability-research/shukla-wiki/tests/not_passing -ferror-limit 19 -fmessage-length 88 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -var-config=config -x c++ error_limit.cpp 
1.  error_limit.cpp:37:7: current parser token '__ctype'
2.  error_limit.cpp:33:5: parsing function body
3.  error_limit.cpp:33:5: in compound statement ('{}')
clang-6.0: error: unable to execute command: Aborted (core dumped)
clang-6.0: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 6.0.1 (git@github.com:rpshukla/varclang.git e0cea416a5cbff277ea1005e2501533dc814ef77) (https://github.com/llvm-mirror/llvm.git 5136df4d089a086b70d452160ad5451861269498)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/ryan/Files/variability-research/build/bin
clang-6.0: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
clang-6.0: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-6.0: note: diagnostic msg: /tmp/error_limit-b457e2.cpp
clang-6.0: note: diagnostic msg: /tmp/error_limit-b457e2.sh
clang-6.0: note: diagnostic msg: 

********************
mayshukla commented 5 years ago

Until this bug is fixed, a workaround is to use -ferror-limit to set the error limit high enough that it is not reached.