[llvm-bugs] [Bug 48701] New: ASTImporterLookupTable.cpp:99 -- Assertion `EraseResult == true && "Trying to remove not contained Decl"'
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jan 8 11:55:52 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=48701
Bug ID: 48701
Summary: ASTImporterLookupTable.cpp:99 -- Assertion
`EraseResult == true && "Trying to remove not
contained Decl"'
Product: clang
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
Assignee: dcoughlin at apple.com
Reporter: vince.a.bridgers at gmail.com
CC: dcoughlin at apple.com, llvm-bugs at lists.llvm.org
We came across a crash in ASTImporterLookupTable.cpp:99, Assertion `EraseResult
== true && "Trying to remove not contained Decl"'. We narrowed this down due to
a regression caused by the following commit:
commit 3f6c856bb5ae4426a586426bca9f1ef2848a2b12
Author: Raphael Isemann <teemperor at gmail.com>
Date: Thu Nov 26 17:02:31 2020 +0100
This conclusion is inferred since the crash does not occur if this commit is
reverted.
crash.sh
--
clang -emit-ast -std=c++11 hpp_libc.cpp -o hpp_libc.cpp.ast
clang -emit-ast -std=c++11 hpp_state.cpp -o hpp_state.cpp.ast
clang --analyze -Xclang -analyzer-checker=core -Xclang -analyzer-config -Xclang
experimental-enable-naive-ctu-analysis=true -Xclang -analyzer-config -Xclang
ctu-dir=`pwd` -Xclang -analyzer-config -Xclang display-ctu-progress=true
-std=c++11 hpp_libc.cpp
externalDefMap.txt
--
c:@F at __assert_fail#*1C#S0_#i#S0_# hpp_libc.cpp.ast
c:@F at BHP_assertfail#*1C#S0_#S0_#S0_#1i#1i# hpp_state.cpp.ast
hpp_libc.cpp
--
void BHP_assertfail(const char* str, const char* assertFunction, const char* p,
const char* assertFile, const unsigned int assertLine, const unsigned int pe);
void __assert_fail(const char* __assertion, const char* __file, unsigned int
__line, const char* __function)
{
BHP_assertfail("Assert in %s: %s, file %s, line %d\n", __function,
__assertion, __file, __line, 0);
}
hpp_state.cpp
--
namespace std
{
typedef long unsigned int size_t;
}
namespace std __attribute__ ((__visibility__ ("default")))
{
template<class _CharT>
struct char_traits;
template<> struct char_traits<char>;
}
namespace std __attribute__ ((__visibility__ ("default")))
{
template<typename _CharT, typename _Traits = char_traits<_CharT> >
class istreambuf_iterator;
template<typename _CharT, typename _Traits = char_traits<_CharT> >
class ostreambuf_iterator;
template<typename _CharT, typename _Traits = char_traits<_CharT> >
class basic_fstream;
typedef basic_fstream<char> fstream;
}
extern "C++" {
namespace std
{
class exception
{
public:
exception() noexcept { }
virtual ~exception() noexcept;
};
} // namespace std
namespace std __attribute__ ((__visibility__ ("default")))
{
struct __true_type { };
struct __false_type { };
template<typename _Tp>
struct __is_char
{
enum { __value = 0 };
typedef __false_type __type;
};
template<typename _Tp>
struct __is_move_iterator
{
enum { __value = 0 };
typedef __false_type __type;
};
template<typename _Iterator>
inline _Iterator
__miter_base(_Iterator __it)
{ return __it; }
} // namespace
namespace __gnu_cxx __attribute__ ((__visibility__ ("default")))
{
template<bool, typename>
struct __enable_if
{ };
template<typename _Tp>
struct __enable_if<true, _Tp>
{ typedef _Tp __type; };
} // namespace
} // extern C++
namespace std __attribute__ ((__visibility__ ("default")))
{
template<typename _CharT>
struct char_traits;
template<typename _CharT, typename _Traits>
class istreambuf_iterator;
template<bool _IsMove, typename _CharT>
typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
ostreambuf_iterator<_CharT, char_traits<_CharT> > >::__type
__copy_move_a2(_CharT*, _CharT*,
ostreambuf_iterator<_CharT, char_traits<_CharT> >);
template<bool _IsMove, typename _CharT>
typename __gnu_cxx::__enable_if<__is_char<_CharT>::__value,
_CharT*>::__type
__copy_move_a2(istreambuf_iterator<_CharT, char_traits<_CharT> >,
istreambuf_iterator<_CharT, char_traits<_CharT> >, _CharT*);
template<typename _II, typename _OI>
inline _OI
copy(_II __first, _II __last, _OI __result)
{
return (std::__copy_move_a2<__is_move_iterator<_II>::__value>
(std::__miter_base(__first), std::__miter_base(__last),
__result));
}
template<typename _II, typename _OI>
inline _OI
move(_II __first, _II __last, _OI __result)
{
}
} // namespace
namespace __gnu_cxx __attribute__ ((__visibility__ ("default")))
{
template<typename _CharT>
struct char_traits
{
typedef _CharT char_type;
static char_type*
copy(char_type* __s1, const char_type* __s2, std::size_t __n);
};
template<typename _CharT>
typename char_traits<_CharT>::char_type*
char_traits<_CharT>::
copy(char_type* __s1, const char_type* __s2, std::size_t __n)
{
std::copy(__s2, __s2 + __n, __s1);
return __s1;
}
} // namespace
namespace std __attribute__ ((__visibility__ ("default")))
{
template<class _CharT>
struct char_traits : public __gnu_cxx::char_traits<_CharT>
{ };
template<>
struct char_traits<char>
{
typedef char char_type;
};
class runtime_error : public exception {
public:
explicit runtime_error(const char * __arg) ;
};
} // namespace
namespace std __attribute__ ((__visibility__ ("default")))
{
class mutex {
public:
mutex() noexcept = default;
~mutex() = default;
};
template<typename _Mutex>
class unique_lock {
public:
unique_lock& operator=(unique_lock&& __u) noexcept {
unique_lock(std::move(__u)).swap(*this);
return *this;
}
};
} // namespace
void BHP_assertfail(const char* str, const char* assertFunction, const char* p,
const char* assertFile, const unsigned int assertLine, const unsigned int pe);
#pragma clang diagnostic ignored "-Wunused-parameter"
void BHP_assertfail(const char* str, const char* assertFunction, const char* p,
const char* assertFile, const unsigned int assertLine, const unsigned int pe)
{
throw(std::runtime_error("Assert failed"));
}
Top of crash stack (Edited)
---
CTU loaded AST file: hpp_state.cpp.ast
clang-12: <root>/clang/lib/AST/ASTImporterLookupTable.cpp:99: void
clang::ASTImporterLookupTable::remove(clang::DeclContext*, clang::NamedDecl*):
Assertion `EraseResult == true && "Trying to remove not contained Decl"'
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: clang-12 --analyze -Xclang -analyzer-checker=core
-Xclang -analyzer-config -Xclang experimental-enable-naive-ctu-analysis=true
-Xclang -analyzer-config -Xclang
ctu-dir=/repo/einvbri/llvm-project-open-famfix/ctu-crash -Xclang
-analyzer-config -Xclang display-ctu-progress=true -std=c++11 hpp_libc.cpp
1. <eof> parser at end of file
2. While analyzing stack:
#0 Calling __assert_fail
3. hpp_libc.cpp:6:3: Error evaluating statement
4. hpp_libc.cpp:6:3: Error evaluating statement
#0 0x0000000003d75077 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
<root>/llvm/lib/Support/Unix/Signals.inc:563:22
#1 0x0000000003d7512e PrintStackTraceSignalHandler(void*)
<root>/llvm/lib/Support/Unix/Signals.inc:630:1
#2 0x0000000003d73130 llvm::sys::RunSignalHandlers()
<root>/llvm/lib/Support/Signals.cpp:71:20
#3 0x0000000003d749eb llvm::sys::CleanupOnSignal(unsigned long)
<root>/llvm/lib/Support/Unix/Signals.inc:361:31
#4 0x0000000003cc0c38 (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long)
<root>/llvm/lib/Support/CrashRecoveryContext.cpp:75:5
#5 0x0000000003cc10d8 CrashRecoverySignalHandler(int)
<root>/llvm/lib/Support/CrashRecoveryContext.cpp:389:1
#6 0x00007f36edff4630 __restore_rt (/lib64/libpthread.so.0+0xf630)
#7 0x00007f36eb41c387 raise (/lib64/libc.so.6+0x36387)
#8 0x00007f36eb41da78 abort (/lib64/libc.so.6+0x37a78)
#9 0x00007f36eb4151a6 __assert_fail_base (/lib64/libc.so.6+0x2f1a6)
#10 0x00007f36eb415252 (/lib64/libc.so.6+0x2f252)
#11 0x0000000007fb4c21
clang::ASTImporterLookupTable::remove(clang::DeclContext*, clang::NamedDecl*)
<root>/clang/lib/AST/ASTImporterLookupTable.cpp:100:1
#12 0x0000000007fb4d2b
clang::ASTImporterLookupTable::remove(clang::NamedDecl*)
<root>/clang/lib/AST/ASTImporterLookupTable.cpp:115:64
#13 0x0000000007f727b9
clang::ASTImporterSharedState::removeDeclFromLookup(clang::Decl*)
<root>/clang/include/clang/AST/ASTImporterSharedState.h:65:3
#14 0x0000000007f6a7c8 clang::ASTImporter::Import(clang::Decl*)
<root>/clang/lib/AST/ASTImporter.cpp:8295:32
#15 0x0000000007f7b994 llvm::Expected<clang::NamedDecl*>
clang::ASTNodeImporter::import<clang::NamedDecl>(clang::NamedDecl*)
<root>/clang/lib/AST/ASTImporter.cpp:165:11
#16 0x0000000007f8cf33 llvm::Error
clang::ASTNodeImporter::ImportArrayChecked<clang::NamedDecl* const*,
clang::NamedDecl**>(clang::NamedDecl* const*, clang::NamedDecl* const*,
clang::NamedDecl**) <root>/clang/lib/AST/ASTImporter.cpp:653:13
--
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/20210108/d9c4d1a3/attachment-0001.html>
More information about the llvm-bugs
mailing list