[llvm-bugs] [Bug 46539] New: Clang crash in clang/include/clang/Sema/Lookup.h:519 Assertion `getResultKind() == Found && "getFoundDecl called on non-unique result"' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 1 18:57:33 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46539

            Bug ID: 46539
           Summary: Clang crash in clang/include/clang/Sema/Lookup.h:519
                    Assertion `getResultKind() == Found && "getFoundDecl
                    called on non-unique result"' failed
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Keywords: crash-on-invalid
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: haoxintu at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

Hi, there.

This case, bug.cc, reduced by C-Reduce, makes clang-trunk crashed.

$cat bug.cc
enum a
}
inline namespace {
class a 
}
struct : b <
struct a {

$clang++ bug.cc
bug.cc:1:7: error: expected ';' after enum
enum a
      ^
      ;
bug.cc:1:6: error: ISO C++ forbids forward references to 'enum' types
enum a
     ^
bug.cc:2:1: error: extraneous closing brace ('}')
}
^
bug.cc:4:8: error: expected ';' after class
class a 
       ^
       ;
clang-11:
/home/haoxin/compilers/llvm-project/clang/include/clang/Sema/Lookup.h:519:
clang::NamedDecl *clang::LookupResult::getFoundDecl() const: Assertion
`getResultKind() == Found && "getFoundDecl called on non-unique result"'
failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments:
/home/haoxin/compilers/llvm-project/build/bin/clang-11 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
bug.cc -mrelocation-model static -mframe-pointer=all -fmath-errno
-fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64
-dwarf-column-info -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir
/home/haoxin/compilers/llvm-project/build/lib/clang/11.0.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/backward
-internal-isystem /usr/local/include -internal-isystem
/home/haoxin/compilers/llvm-project/build/lib/clang/11.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdeprecated-macro -fdebug-compilation-dir
/home/haoxin/bitbucket/scg-backup-bitbucket/ice-test/clang-creduce
-ferror-limit 19 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions
-fcolor-diagnostics -faddrsig -o /tmp/bug-da285a.o -x c++ bug.cc 
1.      bug.cc:7:10: current parser token '{'
2.      bug.cc:6:1: parsing struct/union/class body '(anonymous)'
 #0 0x00000000026f36c4 PrintStackTraceSignalHandler(void*)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x26f36c4)
 #1 0x00000000026f12be llvm::sys::RunSignalHandlers()
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x26f12be)
 #2 0x00000000026f39e5 SignalHandler(int)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x26f39e5)
 #3 0x00007f4e80257890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00007f4e7ecb5e97 raise
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007f4e7ecb7801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00007f4e7eca739a __assert_fail_base
/build/glibc-OTsEL5/glibc-2.27/assert/assert.c:89:0
 #7 0x00007f4e7eca7412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
 #8 0x000000000404e9c6 clang::Sema::ActOnTag(clang::Scope*, unsigned int,
clang::Sema::TagUseKind, clang::SourceLocation, clang::CXXScopeSpec&,
clang::IdentifierInfo*, clang::SourceLocation, clang::ParsedAttributesView
const&, clang::AccessSpecifier, clang::SourceLocation,
llvm::MutableArrayRef<clang::TemplateParameterList*>, bool&, bool&,
clang::SourceLocation, bool,
clang::ActionResult<clang::OpaquePtr<clang::QualType>, false>, bool, bool,
clang::Sema::SkipBodyInfo*)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x404e9c6)
#9 0x0000000003e26dd1 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e26dd1)
#10 0x0000000003e066d3
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e066d3)
#11 0x0000000003dfcb7b
clang::Parser::ParseSpecifierQualifierList(clang::DeclSpec&,
clang::AccessSpecifier, clang::Parser::DeclSpecContext)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3dfcb7b)
#12 0x0000000003dfc82a clang::Parser::ParseTypeName(clang::SourceRange*,
clang::DeclaratorContext, clang::AccessSpecifier, clang::Decl**,
clang::ParsedAttributes*)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3dfc82a)
#13 0x0000000003ea290b clang::Parser::ParseTemplateArgument()
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3ea290b)
#14 0x0000000003ea24fb
clang::Parser::ParseTemplateArgumentList(llvm::SmallVector<clang::ParsedTemplateArgument,
16u>&) (/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3ea24fb)
#15 0x0000000003ea23f0 clang::Parser::ParseTemplateIdAfterTemplateName(bool,
clang::SourceLocation&, llvm::SmallVector<clang::ParsedTemplateArgument, 16u>&,
clang::SourceLocation&)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3ea23f0)
#16 0x0000000003ea0cc7
clang::Parser::AnnotateTemplateIdToken(clang::OpaquePtr<clang::TemplateName>,
clang::TemplateNameKind, clang::CXXScopeSpec&, clang::SourceLocation,
clang::UnqualifiedId&, bool, bool)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3ea0cc7)
#17 0x0000000003e471e3
clang::Parser::ParseOptionalCXXScopeSpecifier(clang::CXXScopeSpec&,
clang::OpaquePtr<clang::QualType>, bool, bool, bool*, bool,
clang::IdentifierInfo**, bool, bool)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e471e3)
#18 0x0000000003e23bfd
clang::Parser::ParseBaseTypeSpecifier(clang::SourceLocation&,
clang::SourceLocation&)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e23bfd)
#19 0x0000000003e2938e clang::Parser::ParseBaseSpecifier(clang::Decl*)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e2938e)
#20 0x0000000003e28d8b clang::Parser::ParseBaseClause(clang::Decl*)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e28d8b)
#21 0x0000000003e28362
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e28362)
#22 0x0000000003e26162
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e26162)
#23 0x0000000003e066d3
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3e066d3)
#24 0x0000000003def66a
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3def66a)
#25 0x0000000003def395
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3def395)
#26 0x0000000003dee1bf
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3dee1bf)
#27 0x0000000003dec28d
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3dec28d)
#28 0x0000000003de770d clang::ParseAST(clang::Sema&, bool, bool)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x3de770d)
#29 0x0000000002ebc3f3 clang::FrontendAction::Execute()
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x2ebc3f3)
#30 0x0000000002e539c3
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x2e539c3)
#31 0x0000000002f67532
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x2f67532)
#32 0x000000000095d060 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x95d060)
#33 0x000000000095b12c ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x95b12c)
#34 0x000000000095addf main
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x95addf)
#35 0x00007f4e7ec98b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#36 0x0000000000957eba _start
(/home/haoxin/compilers/llvm-project/build/bin/clang-11+0x957eba)
clang-11: error: unable to execute command: Aborted (core dumped)
clang-11: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 11.0.0 (https://github.com/llvm/llvm-project
b9306fd042ce1c11d84f05d2124dfdc65b8331fe)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/haoxin/compilers/llvm-project/build/bin
clang-11: note: diagnostic msg: 
********************

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

********************

$clang++ -v
clang version 11.0.0 (https://github.com/llvm/llvm-project
b9306fd042ce1c11d84f05d2124dfdc65b8331fe)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/haoxin/compilers/llvm-project/build/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Candidate multilib: .;@m64
Selected multilib: .;@m64

-- 
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/20200702/cfe18fc3/attachment-0001.html>


More information about the llvm-bugs mailing list