[llvm-bugs] [Bug 50804] New: Assertion failure with 'Operands with constraint "f" cannot overlap with defs'

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 22 11:35:30 PDT 2021


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

            Bug ID: 50804
           Summary: Assertion failure with 'Operands with constraint "f"
                    cannot overlap with defs'
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: it at mgdl.fr
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

Hello everyone, 
I was compiling Clang with LIBC using a version of Clang I had built before.
The compilation fails with an assertion failure in
`llvm/lib/Target/X86/X86FloatingPoint.cpp` and is caused by the compilation of
`llvm/libc/src/math/x86_64/tan.cpp` as well as for the sinus and cos functions.
Here's more detail

```
[509/6763] Building CXX object
projects/libc/src/math/x86_64/CMakeFiles/libc.src.math.x86_64.tan.dir/tan.cpp.o
FAILED:
projects/libc/src/math/x86_64/CMakeFiles/libc.src.math.x86_64.tan.dir/tan.cpp.o 
/usr/local/bin/clang++ -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iprojects/libc/src/math/x86_64
-I/home/michel/sycl_workspace/llvm/libc/src/math/x86_64 -Iinclude
-I/home/michel/sycl_workspace/llvm/llvm/include -Iprojects/libc/include
-I/home/michel/sycl_workspace/llvm/libc -Iprojects/libc -fPIC
-fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time
-Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic
-Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor
-Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion
-Wmisleading-indentation -fdiagnostics-color -ffunction-sections
-fdata-sections -O2 -DNDEBUG -UNDEBUG -fpie -ffreestanding -march=native -O2
-DLLVM_LIBC_PUBLIC_PACKAGING -std=c++17 -MD -MT
projects/libc/src/math/x86_64/CMakeFiles/libc.src.math.x86_64.tan.dir/tan.cpp.o
-MF
projects/libc/src/math/x86_64/CMakeFiles/libc.src.math.x86_64.tan.dir/tan.cpp.o.d
-o
projects/libc/src/math/x86_64/CMakeFiles/libc.src.math.x86_64.tan.dir/tan.cpp.o
-c /home/michel/sycl_workspace/llvm/libc/src/math/x86_64/tan.cpp
clang++:
/home/michel/gitClones/llvm-project/llvm/lib/Target/X86/X86FloatingPoint.cpp:1602:
void (anonymous namespace)::FPS::handleSpecialFP(MachineBasicBlock::iterator
&): Assertion `(1 << getFPReg(MI.getOperand(I)) & STDefs) == 0 && "Operands
with constraint \"f\" cannot overlap with defs"' 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: /usr/local/bin/clang++ -D_DEBUG -D_GNU_SOURCE
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-Iprojects/libc/src/math/x86_64
-I/home/michel/sycl_workspace/llvm/libc/src/math/x86_64 -Iinclude
-I/home/michel/sycl_workspace/llvm/llvm/include -Iprojects/libc/include
-I/home/michel/sycl_workspace/llvm/libc -Iprojects/libc -fPIC
-fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time
-Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic
-Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor
-Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion
-Wmisleading-indentation -fdiagnostics-color -ffunction-sections
-fdata-sections -O2 -DNDEBUG -UNDEBUG -fpie -ffreestanding -march=native -O2
-DLLVM_LIBC_PUBLIC_PACKAGING -std=c++17 -MD -MT
projects/libc/src/math/x86_64/CMakeFiles/libc.src.math.x86_64.tan.dir/tan.cpp.o
-MF
projects/libc/src/math/x86_64/CMakeFiles/libc.src.math.x86_64.tan.dir/tan.cpp.o.d
-o
projects/libc/src/math/x86_64/CMakeFiles/libc.src.math.x86_64.tan.dir/tan.cpp.o
-c /home/michel/sycl_workspace/llvm/libc/src/math/x86_64/tan.cpp
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module
'/home/michel/sycl_workspace/llvm/libc/src/math/x86_64/tan.cpp'.
4.      Running pass 'X86 FP Stackifier' on function '@tan'
 #0 0x00000000029ad983 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/usr/local/bin/clang+++0x29ad983)
 #1 0x00000000029abba0 llvm::sys::RunSignalHandlers()
(/usr/local/bin/clang+++0x29abba0)
 #2 0x00000000029ad02d llvm::sys::CleanupOnSignal(unsigned long)
(/usr/local/bin/clang+++0x29ad02d)
 #3 0x000000000292f2e3 (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long)
CrashRecoveryContext.cpp:0:0
 #4 0x000000000292f468 CrashRecoverySignalHandler(int)
CrashRecoveryContext.cpp:0:0
 #5 0x00007f7c4ee5fb20 __restore_rt sigaction.c:0:0
 #6 0x00007f7c4db6d37f raise (/lib64/libc.so.6+0x3737f)
 #7 0x00007f7c4db57db5 abort (/lib64/libc.so.6+0x21db5)
 #8 0x00007f7c4db57c89 _nl_load_domain.cold.0 loadmsgcat.c:0:0
 #9 0x00007f7c4db65a76 .annobin___GI___assert_fail.end assert.c:0:0
#10 0x0000000001808cda (anonymous
namespace)::FPS::processBasicBlock(llvm::MachineFunction&,
llvm::MachineBasicBlock&) X86FloatingPoint.cpp:0:0
#11 0x0000000001804e3e (anonymous
namespace)::FPS::runOnMachineFunction(llvm::MachineFunction&)
X86FloatingPoint.cpp:0:0
#12 0x0000000001e4e00e
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/usr/local/bin/clang+++0x1e4e00e)
#13 0x000000000223fdf8 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/bin/clang+++0x223fdf8)
#14 0x0000000002246558 llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/local/bin/clang+++0x2246558)
#15 0x00000000022404a8 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/bin/clang+++0x22404a8)
#16 0x0000000002c1963d (anonymous
namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >) BackendUtil.cpp:0:0
#17 0x0000000002c13f35 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef,
llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/local/bin/clang+++0x2c13f35)
#18 0x000000000385c81f
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/bin/clang+++0x385c81f)
#19 0x00000000041e8453 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/bin/clang+++0x41e8453)
#20 0x00000000031f7424 clang::FrontendAction::Execute()
(/usr/local/bin/clang+++0x31f7424)
#21 0x0000000003175628
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/bin/clang+++0x3175628)
#22 0x00000000032a48a8
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/bin/clang+++0x32a48a8)
#23 0x00000000009ce72d cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/bin/clang+++0x9ce72d)
#24 0x00000000009cc59b ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#25 0x00000000030490d2 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const::$_1>(long) Job.cpp:0:0
#26 0x000000000292f1f7
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/usr/local/bin/clang+++0x292f1f7)
#27 0x0000000003048af7
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const (/usr/local/bin/clang+++0x3048af7)
#28 0x000000000301bf3a
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const (/usr/local/bin/clang+++0x301bf3a)
#29 0x000000000301c487
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/usr/local/bin/clang+++0x301c487)
#30 0x00000000030312ac
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/usr/local/bin/clang+++0x30312ac)
#31 0x00000000009cbce6 main (/usr/local/bin/clang+++0x9cbce6)
#32 0x00007f7c4db59493 __libc_start_main (/lib64/libc.so.6+0x23493)
#33 0x00000000009c8c5e _start (/usr/local/bin/clang+++0x9c8c5e)
clang-13: error: clang frontend command failed with exit code 134 (use -v to
see invocation)
clang version 13.0.0 (https://github.com/llvm/llvm-project.git
80b2da42d28466341b9512599aac354c178c39f8)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-13: note: diagnostic msg: 
********************

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

********************
[511/6763] Building CXX object
projects/libc/src/math/x86_64/CMakeFiles/libc.src.math.x86_64.sin.dir/sin.cpp.o
FAILED:
projects/libc/src/math/x86_64/CMakeFiles/libc.src.math.x86_64.sin.dir/sin.cpp.o 
/usr/local/bin/clang++ -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iprojects/libc/src/math/x86_64
-I/home/michel/sycl_workspace/llvm/libc/src/math/x86_64 -Iinclude
-I/home/michel/sycl_workspace/llvm/llvm/include -Iprojects/libc/include
-I/home/michel/sycl_workspace/llvm/libc -Iprojects/libc -fPIC
-fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time
-Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic
-Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor
-Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion
-Wmisleading-indentation -fdiagnostics-color -ffunction-sections
-fdata-sections -O2 -DNDEBUG -UNDEBUG -fpie -ffreestanding -march=native -O2
-DLLVM_LIBC_PUBLIC_PACKAGING -std=c++17 -MD -MT
projects/libc/src/math/x86_64/CMakeFiles/libc.src.math.x86_64.sin.dir/sin.cpp.o
-MF
projects/libc/src/math/x86_64/CMakeFiles/libc.src.math.x86_64.sin.dir/sin.cpp.o.d
-o
projects/libc/src/math/x86_64/CMakeFiles/libc.src.math.x86_64.sin.dir/sin.cpp.o
-c /home/michel/sycl_workspace/llvm/libc/src/math/x86_64/sin.cpp
clang++:
/home/michel/gitClones/llvm-project/llvm/lib/Target/X86/X86FloatingPoint.cpp:1602:
void (anonymous namespace)::FPS::handleSpecialFP(MachineBasicBlock::iterator
&): Assertion `(1 << getFPReg(MI.getOperand(I)) & STDefs) == 0 && "Operands
with constraint \"f\" cannot overlap with defs"' 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: /usr/local/bin/clang++ -D_DEBUG -D_GNU_SOURCE
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-Iprojects/libc/src/math/x86_64
-I/home/michel/sycl_workspace/llvm/libc/src/math/x86_64 -Iinclude
-I/home/michel/sycl_workspace/llvm/llvm/include -Iprojects/libc/include
-I/home/michel/sycl_workspace/llvm/libc -Iprojects/libc -fPIC
-fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time
-Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic
-Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor
-Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion
-Wmisleading-indentation -fdiagnostics-color -ffunction-sections
-fdata-sections -O2 -DNDEBUG -UNDEBUG -fpie -ffreestanding -march=native -O2
-DLLVM_LIBC_PUBLIC_PACKAGING -std=c++17 -MD -MT
projects/libc/src/math/x86_64/CMakeFiles/libc.src.math.x86_64.sin.dir/sin.cpp.o
-MF
projects/libc/src/math/x86_64/CMakeFiles/libc.src.math.x86_64.sin.dir/sin.cpp.o.d
-o
projects/libc/src/math/x86_64/CMakeFiles/libc.src.math.x86_64.sin.dir/sin.cpp.o
-c /home/michel/sycl_workspace/llvm/libc/src/math/x86_64/sin.cpp
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module
'/home/michel/sycl_workspace/llvm/libc/src/math/x86_64/sin.cpp'.
4.      Running pass 'X86 FP Stackifier' on function '@sin'
 #0 0x00000000029ad983 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/usr/local/bin/clang+++0x29ad983)
 #1 0x00000000029abba0 llvm::sys::RunSignalHandlers()
(/usr/local/bin/clang+++0x29abba0)
 #2 0x00000000029ad02d llvm::sys::CleanupOnSignal(unsigned long)
(/usr/local/bin/clang+++0x29ad02d)
 #3 0x000000000292f2e3 (anonymous
namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long)
CrashRecoveryContext.cpp:0:0
 #4 0x000000000292f468 CrashRecoverySignalHandler(int)
CrashRecoveryContext.cpp:0:0
 #5 0x00007ff946b55b20 __restore_rt sigaction.c:0:0
 #6 0x00007ff94586337f raise (/lib64/libc.so.6+0x3737f)
 #7 0x00007ff94584ddb5 abort (/lib64/libc.so.6+0x21db5)
 #8 0x00007ff94584dc89 _nl_load_domain.cold.0 loadmsgcat.c:0:0
 #9 0x00007ff94585ba76 .annobin___GI___assert_fail.end assert.c:0:0
#10 0x0000000001808cda (anonymous
namespace)::FPS::processBasicBlock(llvm::MachineFunction&,
llvm::MachineBasicBlock&) X86FloatingPoint.cpp:0:0
#11 0x0000000001804e3e (anonymous
namespace)::FPS::runOnMachineFunction(llvm::MachineFunction&)
X86FloatingPoint.cpp:0:0
#12 0x0000000001e4e00e
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/usr/local/bin/clang+++0x1e4e00e)
#13 0x000000000223fdf8 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/bin/clang+++0x223fdf8)
#14 0x0000000002246558 llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/local/bin/clang+++0x2246558)
#15 0x00000000022404a8 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/bin/clang+++0x22404a8)
#16 0x0000000002c1963d (anonymous
namespace)::EmitAssemblyHelper::EmitAssemblyWithNewPassManager(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >) BackendUtil.cpp:0:0
#17 0x0000000002c13f35 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef,
llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/local/bin/clang+++0x2c13f35)
#18 0x000000000385c81f
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/bin/clang+++0x385c81f)
#19 0x00000000041e8453 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/bin/clang+++0x41e8453)
#20 0x00000000031f7424 clang::FrontendAction::Execute()
(/usr/local/bin/clang+++0x31f7424)
#21 0x0000000003175628
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/bin/clang+++0x3175628)
#22 0x00000000032a48a8
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/bin/clang+++0x32a48a8)
#23 0x00000000009ce72d cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/bin/clang+++0x9ce72d)
#24 0x00000000009cc59b ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
driver.cpp:0:0
#25 0x00000000030490d2 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const::$_1>(long) Job.cpp:0:0
#26 0x000000000292f1f7
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/usr/local/bin/clang+++0x292f1f7)
#27 0x0000000003048af7
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
>, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) const (/usr/local/bin/clang+++0x3048af7)
#28 0x000000000301bf3a
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const (/usr/local/bin/clang+++0x301bf3a)
#29 0x000000000301c487
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/usr/local/bin/clang+++0x301c487)
#30 0x00000000030312ac
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/usr/local/bin/clang+++0x30312ac)
#31 0x00000000009cbce6 main (/usr/local/bin/clang+++0x9cbce6)
#32 0x00007ff94584f493 __libc_start_main (/lib64/libc.so.6+0x23493)
#33 0x00000000009c8c5e _start (/usr/local/bin/clang+++0x9c8c5e)
clang-13: error: clang frontend command failed with exit code 134 (use -v to
see invocation)
clang version 13.0.0 (https://github.com/llvm/llvm-project.git
80b2da42d28466341b9512599aac354c178c39f8)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-13: note: diagnostic msg: 
********************

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

```

-- 
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/20210622/ba4c49ef/attachment-0001.html>


More information about the llvm-bugs mailing list