llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
26.82k stars 11k forks source link

valgrind error at CodeGenModule.cpp:2531 #94661

Open dcb314 opened 1 month ago

dcb314 commented 1 month ago

From the clang testsuite, file ./Analysis/analysis-after-multiple-dtors.cpp does this with a valgrind version of recent clang:

test $ valgrind -q --trace-children=yes ~/llvm/results/bin/clang++ -c -w ./Analysis/analysis-after-multiple-dtors.cpp ==424675== Conditional jump or move depends on uninitialised value(s) ==424675== at 0x2429FF9: clang::CodeGen::CodeGenModule::SetLLVMFunctionAttributesForDefinition(clang::Decl const, llvm::Function) (CodeGenModule.cpp:2531) ==424675== by 0x26F5B23: clang::CodeGen::CodeGenModule::codegenCXXStructor(clang::GlobalDecl) (CGCXX.cpp:216)

The source code line in error is

if (isa<CXXMethodDecl>(D) && F->getPointerAlignment(getDataLayout()) < 2)

The bug first seems to occur sometime between git hash 1579e9ca9ce17364963861517fecf13b00fe4d8a and 83646590afe222cfdd792514854549077e17b005.

llvmbot commented 1 month ago

@llvm/issue-subscribers-clang-codegen

Author: None (dcb314)

From the clang testsuite, file ./Analysis/analysis-after-multiple-dtors.cpp does this with a valgrind version of recent clang: test $ valgrind -q --trace-children=yes ~/llvm/results/bin/clang++ -c -w ./Analysis/analysis-after-multiple-dtors.cpp ==424675== Conditional jump or move depends on uninitialised value(s) ==424675== at 0x2429FF9: clang::CodeGen::CodeGenModule::SetLLVMFunctionAttributesForDefinition(clang::Decl const*, llvm::Function*) (CodeGenModule.cpp:2531) ==424675== by 0x26F5B23: clang::CodeGen::CodeGenModule::codegenCXXStructor(clang::GlobalDecl) (CGCXX.cpp:216) The source code line in error is if (isa<CXXMethodDecl>(D) && F->getPointerAlignment(getDataLayout()) < 2) The bug first seems to occur sometime between git hash 1579e9ca9ce17364963861517fecf13b00fe4d8a and 83646590afe222cfdd792514854549077e17b005.