<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - ModuleSummaryAnalysis assert with inline assembly"
href="https://bugs.llvm.org/show_bug.cgi?id=46325">46325</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>ModuleSummaryAnalysis assert with inline assembly
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Global Analyses
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>itay.bookstein@nextsilicon.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Compiling the following piece of code to an object file 'works' normally, but
crashes with an assert when passing -flto (this is after whittling the repro
down using creduce):
// memcpy.c
asm("memcpy = __GI_memcpy");
void (*c)(void) __asm__("__new_memcpy");
void memcpy(void) __attribute__((alias("__new_memcpy")));
// build.sh
clang-11 memcpy.c -c -o /dev/null
clang-11 memcpy.c -c -o /dev/null -flto
I'm not sure whether the code should even be accepted by clang or not. In
principal this is derived from glibc code, but after reducing the repro gcc no
longer accepts this.
Below is the stack trace of the assert:
#11 0x0000000007531bbf llvm::buildModuleSummaryIndex(llvm::Module const&,
std::function<llvm::BlockFrequencyInfo* (llvm::Function const&)>,
llvm::ProfileSummaryInfo*, std::function<llvm::StackSafetyInfo const*
(llvm::Function const&)>)::$_0::operator()(llvm::S[28/4985]
llvm::object::BasicSymbolRef::Flags) const
/local/users/itay/Projects/llvm-project/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp:703:59
#12 0x0000000007531ad6 void llvm::function_ref<void (llvm::StringRef,
llvm::object::BasicSymbolRef::Flags)>::callback_fn<llvm::buildModuleSummaryIndex(llvm::Module
const&, std::function<llvm::BlockFrequencyInfo* (llvm::Function const&)>,
llvm::ProfileSummaryInfo*, std::function<llvm::StackSafetyInfo const*
(llvm::Function const&)>)::$_0>(long, llvm::StringRef,
llvm::object::BasicSymbolRef::Flags)
/local/users/itay/Projects/llvm-project/llvm/include/llvm/ADT/STLExtras.h:185:5
#13 0x000000000d78bbe2 llvm::function_ref<void (llvm::StringRef,
llvm::object::BasicSymbolRef::Flags)>::operator()(llvm::StringRef,
llvm::object::BasicSymbolRef::Flags) const
/local/users/itay/Projects/llvm-project/llvm/include/llvm/ADT/STLExtras.h:203:5
#14 0x000000000d78a7f2 llvm::ModuleSymbolTable::CollectAsmSymbols(llvm::Module
const&, llvm::function_ref<void (llvm::StringRef,
llvm::object::BasicSymbolRef::Flags)>)::$_2::operator()(llvm::RecordStreamer&)
const
/local/users/itay/Projects/llvm-project/llvm/lib/Object/ModuleSymbolTable.cpp:132:19
#15 0x000000000d78a690 void llvm::function_ref<void
(llvm::RecordStreamer&)>::callback_fn<llvm::ModuleSymbolTable::CollectAsmSymbols(llvm::Module
const&, llvm::function_ref<void (llvm::StringRef,
llvm::object::BasicSymbolRef::Flags)>)::$_2>(long, llvm::RecordStreamer&)
/local/users/itay/Projects/llvm-project/llvm/include/llvm/ADT/STLExtras.h:185:5
#16 0x000000000d78abec llvm::function_ref<void
(llvm::RecordStreamer&)>::operator()(llvm::RecordStreamer&) const
/local/users/itay/Projects/llvm-project/llvm/include/llvm/ADT/STLExtras.h:203:5
#17 0x000000000d78a062 initializeRecordStreamer(llvm::Module const&,
llvm::function_ref<void (llvm::RecordStreamer&)>)
/local/users/itay/Projects/llvm-project/llvm/lib/Object/ModuleSymbolTable.cpp:124:1
#18 0x000000000d7899ec llvm::ModuleSymbolTable::CollectAsmSymbols(llvm::Module
const&, llvm::function_ref<void (llvm::StringRef,
llvm::object::BasicSymbolRef::Flags)>)
/local/users/itay/Projects/llvm-project/llvm/lib/Object/ModuleSymbolTable.cpp:161:1
#19 0x000000000752d54a llvm::buildModuleSummaryIndex(llvm::Module const&,
std::function<llvm::BlockFrequencyInfo* (llvm::Function const&)>,
llvm::ProfileSummaryInfo*, std::function<llvm::StackSafetyInfo const*
(llvm::Function const&)>)
/local/users/itay/Projects/llvm-project/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp:740:8
#20 0x000000000753031a
llvm::ModuleSummaryIndexWrapperPass::runOnModule(llvm::Module&)
/local/users/itay/Projects/llvm-project/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp:884:9
#21 0x0000000007d64da8 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/local/users/itay/Projects/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1583:23
#22 0x0000000007d648d5 llvm::legacy::PassManagerImpl::run(llvm::Module&)
/local/users/itay/Projects/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1695:16
#23 0x0000000007d65331 llvm::legacy::PassManager::run(llvm::Module&)
/local/users/itay/Projects/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1726:3
#24 0x0000000008c9aebf (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
/local/users/itay/Projects/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:955:3#25
0x0000000008c96f18 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
/local/users/itay/Projects/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1666:5
#26 0x0000000009915457
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
/local/users/itay/Projects/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:335:7
#27 0x000000000bbcf56e clang::ParseAST(clang::Sema&, bool, bool)
/local/users/itay/Projects/llvm-project/clang/lib/Parse/ParseAST.cpp:178:12
#28 0x00000000097539b2 clang::ASTFrontendAction::ExecuteAction()
/local/users/itay/Projects/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1062:1
#29 0x00000000099117a9 clang::CodeGenAction::ExecuteAction()
/local/users/itay/Projects/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1185:1
#30 0x0000000009753361 clang::FrontendAction::Execute()
/local/users/itay/Projects/llvm-project/clang/lib/Frontend/FrontendAction.cpp:957:7
#31 0x000000000967b69e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/local/users/itay/Projects/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:973:23
#32 0x00000000098fd78d
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/local/users/itay/Projects/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:282:8
#33 0x0000000005782ad8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
/local/users/itay/Projects/llvm-project/clang/tools/driver/cc1_main.cpp:240:13
#34 0x0000000005776686 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
/local/users/itay/Projects/llvm-project/clang/tools/driver/driver.cpp:330:5
#35 0x000000000956fb28
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
std::allocator<char> >*, bool*) const::$_1::operator()() const
/local/users/itay/Projects/llvm-project/clang/lib/Driver/Job.cpp:417:30</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>