<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 - cross compiling with arm-unknown-linux-musl and some features crashes clang"
href="https://bugs.llvm.org/show_bug.cgi?id=49685">49685</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>cross compiling with arm-unknown-linux-musl and some features crashes clang
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>11.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>vincent@rischmann.fr
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=24678" name="attach_24678" title="code archive to reproduce">attachment 24678</a> <a href="attachment.cgi?id=24678&action=edit" title="code archive to reproduce">[details]</a></span>
code archive to reproduce
Hello,
cross compiling with `arm-unknown-linux-musl` and the following features:
-Xclang -target-feature -Xclang +d32 \
-Xclang -target-feature -Xclang +fp64 \
-Xclang -target-feature -Xclang +fpregs \
-Xclang -target-feature -Xclang +neon \
-Xclang -target-feature -Xclang +vfp2 \
-Xclang -target-feature -Xclang +vfp2sp \
-Xclang -target-feature -Xclang +vfp3 \
-Xclang -target-feature -Xclang +vfp3d16 \
-Xclang -target-feature -Xclang +vfp3d16sp \
-Xclang -target-feature -Xclang +vfp3sp \
crashes the compiler in some cases:
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: clang -target arm-unknown-linux-musl -nostdinc
-Xclang -target-feature -Xclang +d32 -Xclang -target-feature -Xclang +fp64
-Xclang -target-feature -Xclang +fpregs -Xclang -target-feature -Xclang +neon
-Xclang -target-feature -Xclang +vfp2 -Xclang -target-feature -Xclang +vfp2sp
-Xclang -target-feature -Xclang +vfp3 -Xclang -target-feature -Xclang +vfp3d16
-Xclang -target-feature -Xclang +vfp3d16sp -Xclang -target-feature -Xclang
+vfp3sp -c alarm.c -ffreestanding -w -I musl/arch/arm -I musl/arch/generic -I
musl/src/include -I musl/src/internal -I musl/include -I include/arm-linux-musl
-I include/generic-musl
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'alarm.c'.
4. Running pass 'ARM Instruction Selection' on function '@alarm'
#0 0x0000000002336d3a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/vincent/local/bin/clang-11+0x2336d3a)
#1 0x0000000002334ef4 llvm::sys::RunSignalHandlers()
(/home/vincent/local/bin/clang-11+0x2334ef4)
#2 0x00000000022c5df8 CrashRecoverySignalHandler(int)
(/home/vincent/local/bin/clang-11+0x22c5df8)
#3 0x00007f61849301e0 __restore_rt (/lib64/libpthread.so.0+0x141e0)
#4 0x0000000002f27137
llvm::DAGTypeLegalizer::SoftenFloatOp_BR_CC(llvm::SDNode*)
(/home/vincent/local/bin/clang-11+0x2f27137)
#5 0x0000000002f28325
llvm::DAGTypeLegalizer::SoftenFloatOperand(llvm::SDNode*, unsigned int)
(/home/vincent/local/bin/clang-11+0x2f28325)
#6 0x0000000002eceb95 llvm::DAGTypeLegalizer::run()
(/home/vincent/local/bin/clang-11+0x2eceb95)
#7 0x0000000002ecefa9 llvm::SelectionDAG::LegalizeTypes()
(/home/vincent/local/bin/clang-11+0x2ecefa9)
#8 0x0000000002e7f191 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/home/vincent/local/bin/clang-11+0x2e7f191)
#9 0x0000000002e82416
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/home/vincent/local/bin/clang-11+0x2e82416)
#10 0x0000000002e845aa
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/home/vincent/local/bin/clang-11+0x2e845aa)
#11 0x0000000000dfab14 (anonymous
namespace)::ARMDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/home/vincent/local/bin/clang-11+0xdfab14)
#12 0x0000000001a3af90
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0)
(/home/vincent/local/bin/clang-11+0x1a3af90)
#13 0x0000000001d34268 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/vincent/local/bin/clang-11+0x1d34268)
#14 0x0000000001d34993 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/vincent/local/bin/clang-11+0x1d34993)
#15 0x0000000001d330bd llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/vincent/local/bin/clang-11+0x1d330bd)
#16 0x000000000252658e (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/home/vincent/local/bin/clang-11+0x252658e)
#17 0x0000000002527b8f 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> >)
(/home/vincent/local/bin/clang-11+0x2527b8f)
#18 0x0000000002f634ef
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/vincent/local/bin/clang-11+0x2f634ef)
#19 0x0000000003700f79 clang::ParseAST(clang::Sema&, bool, bool)
(/home/vincent/local/bin/clang-11+0x3700f79)
#20 0x0000000002a135b1 clang::FrontendAction::Execute()
(/home/vincent/local/bin/clang-11+0x2a135b1)
#21 0x00000000029d210b
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/vincent/local/bin/clang-11+0x29d210b)
#22 0x0000000002aaa47b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/vincent/local/bin/clang-11+0x2aaa47b)
#23 0x0000000000932fa8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/vincent/local/bin/clang-11+0x932fa8)
#24 0x0000000000930e53 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/home/vincent/local/bin/clang-11+0x930e53)
#25 0x00000000028cb685 void llvm::function_ref<void
()>::callback_fn<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::'lambda'()>(long)
(/home/vincent/local/bin/clang-11+0x28cb685)
#26 0x00000000022c5ef3
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/home/vincent/local/bin/clang-11+0x22c5ef3)
#27 0x00000000028cc331
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 (.part.0)
(/home/vincent/local/bin/clang-11+0x28cc331)
#28 0x00000000028a6c39
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/home/vincent/local/bin/clang-11+0x28a6c39)
#29 0x00000000028a713d
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/home/vincent/local/bin/clang-11+0x28a713d)
#30 0x00000000028b0d49
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/home/vincent/local/bin/clang-11+0x28b0d49)
#31 0x000000000089124d main (/home/vincent/local/bin/clang-11+0x89124d)
#32 0x00007f61843d31e2 __libc_start_main (/lib64/libc.so.6+0x281e2)
#33 0x000000000093035e _start (/home/vincent/local/bin/clang-11+0x93035e)
clang-11: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 11.0.1
Target: arm-unknown-linux-musl
Thread model: posix
InstalledDir: /home/vincent/local/bin
Removing any of the feature flag makes it work.
I don't know if these flags make sense as is, I encountered this with Zig
building musl, however it's easily reproducible with just clang.
I've attached an archive with the code and a script to reproduce.
I've also tested with clang 12.0.0rc3, it crashes too.</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>