<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 - "error in backend: Cannot select" occured when compiling the code includes incompatible redeclaration of library function"
   href="https://bugs.llvm.org/show_bug.cgi?id=45410">45410</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>"error in backend: Cannot select" occured when compiling the code includes incompatible redeclaration of library function
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>10.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>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: AArch64
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>utsumi.yuichiro@fujitsu.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>arnaud.degrandmaison@arm.com, llvm-bugs@lists.llvm.org, smithp352@googlemail.com, Ties.Stuij@arm.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When compiling the following code with `-Ofast`, "fatal error: error in
backend: Cannot select" occured.

test.c

```
float test() {
  extern float exp();
  return exp(1);
}
```

The compile command and the error are below.

$ clang -Ofast -c test.c
test.c:2:16: warning: incompatible redeclaration of library function 'exp'
[-Wincompatible-library-redeclaration]
  extern float exp();
               ^
test.c:2:16: note: 'exp' is a builtin with type 'double (double)'
fatal error: error in backend: Cannot select: 0x3c772078: i32 = fexp
Constant:i32<1>
  0x3c772010: i32 = Constant<1>
In function: test
Stack dump:
0.      Program arguments: clang -Ofast -c test.c
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'test.c'.
4.      Running pass 'AArch64 Instruction Selection' on function '@test'
 #0 0x0000ffff87d0ad20 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/work02/lang2/utsumi/install10/bin/../lib64/libLLVMSupport.so.10+0x15ad20)
 #1 0x0000ffff87d09048 llvm::sys::RunSignalHandlers()
(/work02/lang2/utsumi/install10/bin/../lib64/libLLVMSupport.so.10+0x159048)
 #2 0x0000ffff87d092e0 llvm::sys::CleanupOnSignal(unsigned long)
(/work02/lang2/utsumi/install10/bin/../lib64/libLLVMSupport.so.10+0x1592e0)
 #3 0x0000ffff87c4fb68 llvm::CrashRecoveryContext::HandleExit(int)
(/work02/lang2/utsumi/install10/bin/../lib64/libLLVMSupport.so.10+0x9fb68)
 #4 0x0000ffff87d03918 llvm::sys::Process::Exit(int)
(/work02/lang2/utsumi/install10/bin/../lib64/libLLVMSupport.so.10+0x153918)
 #5 0x0000000000411474 LLVMErrorHandler(void*, std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, bool)
(/work02/lang2/utsumi/install10/bin/clang-10+0x411474)
 #6 0x0000ffff87c5c514 llvm::report_fatal_error(llvm::Twine const&, bool)
(/work02/lang2/utsumi/install10/bin/../lib64/libLLVMSupport.so.10+0xac514)
 #7 0x0000ffff87c5c644
(/work02/lang2/utsumi/install10/bin/../lib64/libLLVMSupport.so.10+0xac644)
 #8 0x0000ffff86bf08fc llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*)
(/work02/lang2/utsumi/install10/bin/../lib64/../lib64/libLLVMSelectionDAG.so.10+0x1d08fc)
 #9 0x0000ffff86bf19b4 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*,
unsigned char const*, unsigned int)
(/work02/lang2/utsumi/install10/bin/../lib64/../lib64/libLLVMSelectionDAG.so.10+0x1d19b4)
#10 0x0000ffff8a7d71dc (anonymous
namespace)::AArch64DAGToDAGISel::Select(llvm::SDNode*)
(/work02/lang2/utsumi/install10/bin/../lib64/libLLVMAArch64CodeGen.so.10+0xb71dc)
#11 0x0000ffff86bef750 llvm::SelectionDAGISel::DoInstructionSelection()
(/work02/lang2/utsumi/install10/bin/../lib64/../lib64/libLLVMSelectionDAG.so.10+0x1cf750)
#12 0x0000ffff86bf4da8 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/work02/lang2/utsumi/install10/bin/../lib64/../lib64/libLLVMSelectionDAG.so.10+0x1d4da8)
#13 0x0000ffff86bf835c
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/work02/lang2/utsumi/install10/bin/../lib64/../lib64/libLLVMSelectionDAG.so.10+0x1d835c)
#14 0x0000ffff86bfa68c
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(.part.921)
(/work02/lang2/utsumi/install10/bin/../lib64/../lib64/libLLVMSelectionDAG.so.10+0x1da68c)
#15 0x0000ffff8a12e6e8
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.45)
(/work02/lang2/utsumi/install10/bin/../lib64/libLLVMCodeGen.so.10+0x20e6e8)
#16 0x0000ffff88650cfc llvm::FPPassManager::runOnFunction(llvm::Function&)
(/work02/lang2/utsumi/install10/bin/../lib64/libLLVMCore.so.10+0x190cfc)
#17 0x0000ffff88651398 llvm::FPPassManager::runOnModule(llvm::Module&)
(/work02/lang2/utsumi/install10/bin/../lib64/libLLVMCore.so.10+0x191398)
#18 0x0000ffff886516e8 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/work02/lang2/utsumi/install10/bin/../lib64/libLLVMCore.so.10+0x1916e8)
#19 0x0000ffff89a78cc8 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/work02/lang2/utsumi/install10/bin/../lib64/libclangCodeGen.so.10+0xa8cc8)
#20 0x0000ffff89a795ec 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> >)
(/work02/lang2/utsumi/install10/bin/../lib64/libclangCodeGen.so.10+0xa95ec)
#21 0x0000ffff89cccf74
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/work02/lang2/utsumi/install10/bin/../lib64/libclangCodeGen.so.10+0x2fcf74)
#22 0x0000ffff85ee24ec clang::ParseAST(clang::Sema&, bool, bool)
(/work02/lang2/utsumi/install10/bin/../lib64/../lib64/libclangParse.so.10+0x324ec)
#23 0x0000ffff896ebcf0 clang::FrontendAction::Execute()
(/work02/lang2/utsumi/install10/bin/../lib64/libclangFrontend.so.10+0xcbcf0)
#24 0x0000ffff896b2f70
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/work02/lang2/utsumi/install10/bin/../lib64/libclangFrontend.so.10+0x92f70)
#25 0x0000ffff895f42ec
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/work02/lang2/utsumi/install10/bin/../lib64/libclangFrontendTool.so.10+0x42ec)
#26 0x0000000000411c10 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/work02/lang2/utsumi/install10/bin/clang-10+0x411c10)
#27 0x000000000040fe9c ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/work02/lang2/utsumi/install10/bin/clang-10+0x40fe9c)
#28 0x0000ffff8983e14c 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)
(/work02/lang2/utsumi/install10/bin/../lib64/libclangDriver.so.10+0x7e14c)
#29 0x0000ffff87c4f9cc
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/work02/lang2/utsumi/install10/bin/../lib64/libLLVMSupport.so.10+0x9f9cc)
#30 0x0000ffff8983ed48
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.166)
(/work02/lang2/utsumi/install10/bin/../lib64/libclangDriver.so.10+0x7ed48)
#31 0x0000ffff8981dcd8
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/work02/lang2/utsumi/install10/bin/../lib64/libclangDriver.so.10+0x5dcd8)
#32 0x0000ffff8981e3cc
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/work02/lang2/utsumi/install10/bin/../lib64/libclangDriver.so.10+0x5e3cc)
#33 0x0000ffff898278f8
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/work02/lang2/utsumi/install10/bin/../lib64/libclangDriver.so.10+0x678f8)
#34 0x000000000040e5c0 main
(/work02/lang2/utsumi/install10/bin/clang-10+0x40e5c0)
#35 0x0000ffff86eb15d4 __libc_start_main (/lib64/libc.so.6+0x215d4)
#36 0x000000000040f924 _start
(/work02/lang2/utsumi/install10/bin/clang-10+0x40f924)
clang-10: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 10.0.0 (/work02/lang2/utsumi/llvm-project/clang
d32170dbd5b0d54436537b6b75beaf44324e0c28)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /work02/lang2/utsumi/install10/bin</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>