Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[OpenMP] Assertion `llvm::isPowerOf2_64(Value) && "Alignment is not a power of 2"' failed. #140080

Copy link
Copy link
Open
@k-arrows

Description

@k-arrows
Issue body actions

Reproducer:
https://godbolt.org/z/b387aMKxa

void f(long double ld) {

#pragma omp atomic compare
  ld = ld == 0.0L ? 1.0L : ld;
}

The original reproducer of this issue is the following:
https://github.com/gcc-mirror/gcc/blob/master/libgomp/testsuite/libgomp.c-c%2B%2B-common/atomic-21.c

Backtrace:

clang++: /root/llvm-project/llvm/include/llvm/Support/Alignment.h:78: llvm::Align::Align(uint64_t): Assertion `llvm::isPowerOf2_64(Value) && "Alignment is not a power of 2"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -fopenmp <source>
1.	<eof> parser at end of file
2.	Per-file LLVM IR generation
3.	<source>:1:6: Generating code for declaration 'f'
 #0 0x0000000003f99d48 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f99d48)
 #1 0x0000000003f979d4 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3f979d4)
 #2 0x0000000003edc608 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x0000707d17242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x0000707d172969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x0000707d17242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x0000707d172287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x0000707d1722871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x0000707d17239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x0000000000ec4e6f llvm::Align::Align(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xec4e6f)
#10 0x00000000030b5dea llvm::IRBuilderBase::CreateAtomicCmpXchg(llvm::Value*, llvm::Value*, llvm::Value*, llvm::MaybeAlign, llvm::AtomicOrdering, llvm::AtomicOrdering, unsigned char) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x30b5dea)
#11 0x0000000008011616 llvm::OpenMPIRBuilder::createAtomicCompare(llvm::OpenMPIRBuilder::LocationDescription const&, llvm::OpenMPIRBuilder::AtomicOpValue&, llvm::OpenMPIRBuilder::AtomicOpValue&, llvm::OpenMPIRBuilder::AtomicOpValue&, llvm::Value*, llvm::Value*, llvm::AtomicOrdering, llvm::omp::OMPAtomicCompareOp, bool, bool, bool, llvm::AtomicOrdering) (.part.0) OMPIRBuilder.cpp:0:0
#12 0x00000000080120be llvm::OpenMPIRBuilder::createAtomicCompare(llvm::OpenMPIRBuilder::LocationDescription const&, llvm::OpenMPIRBuilder::AtomicOpValue&, llvm::OpenMPIRBuilder::AtomicOpValue&, llvm::OpenMPIRBuilder::AtomicOpValue&, llvm::Value*, llvm::Value*, llvm::AtomicOrdering, llvm::omp::OMPAtomicCompareOp, bool, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x80120be)
#13 0x00000000044c8ee4 clang::CodeGen::CodeGenFunction::EmitOMPAtomicDirective(clang::OMPAtomicDirective const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44c8ee4)
#14 0x000000000447a66e clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x447a66e)
#15 0x00000000044823cc clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44823cc)
#16 0x00000000044e8586 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44e8586)
#17 0x00000000044fba0b clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x44fba0b)
#18 0x00000000045659d5 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x45659d5)
#19 0x0000000004560b44 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4560b44)
#20 0x000000000456d347 clang::CodeGen::CodeGenModule::EmitDeferred() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x456d347)
#21 0x000000000456f8d3 clang::CodeGen::CodeGenModule::Release() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x456f8d3)
#22 0x000000000494840e (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ModuleBuilder.cpp:0:0
#23 0x0000000004944825 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4944825)
#24 0x000000000662d34c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x662d34c)
#25 0x0000000004944fd8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4944fd8)
#26 0x0000000004c3cea5 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4c3cea5)
#27 0x0000000004bbbb3e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4bbbb3e)
#28 0x0000000004d30a49 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4d30a49)
#29 0x0000000000dac29f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xdac29f)
#30 0x0000000000da246a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#31 0x00000000049ac2c9 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#32 0x0000000003edcaa4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3edcaa4)
#33 0x00000000049ac8df clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#34 0x000000000496e6ad clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x496e6ad)
#35 0x000000000496f73e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x496f73e)
#36 0x0000000004977a25 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4977a25)
#37 0x0000000000da8208 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xda8208)
#38 0x0000000000c2df44 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xc2df44)
#39 0x0000707d17229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#40 0x0000707d17229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#41 0x0000000000da1f15 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xda1f15)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:codegenIR generation bugs: mangling, exceptions, etc.IR generation bugs: mangling, exceptions, etc.clang:openmpOpenMP related changes to ClangOpenMP related changes to ClangconfirmedVerified by a second partyVerified by a second partycrash-on-valid

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.