[LLVMbugs] [Bug 15598] New: MemorySanitizer: use of uninitialized value (CalleeWithThisReturn) in CodeGenFunction::EmitFunctionEpilog

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Mar 26 08:03:45 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=15598

            Bug ID: 15598
           Summary: MemorySanitizer: use of uninitialized value
                    (CalleeWithThisReturn) in
                    CodeGenFunction::EmitFunctionEpilog
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eugeni.stepanov at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

MemorySanitizer report:

WARNING: Use of uninitialized value
    #0 0x7f90105f9b2b in
clang::CodeGen::CodeGenFunction::EmitFunctionEpilog(clang::CodeGen::CGFunctionInfo
const&) tools/clang/lib/CodeGen/CGCall.cpp:1727
    #1 0x7f90103b8e98 in
clang::CodeGen::CodeGenFunction::FinishFunction(clang::SourceLocation)
tools/clang/lib/CodeGen/CodeGenFunction.cpp:207
    #2 0x7f901039bc92 in
clang::CodeGen::CodeGenFunction::GenerateThunk(llvm::Function*,
clang::CodeGen::CGFunctionInfo const&, clang::GlobalDecl, clang::ThunkInfo
const&) tools/clang/lib/CodeGen/CGVTables.cpp:379
    #3 0x7f901039e7af in
clang::CodeGen::CodeGenVTables::EmitThunk(clang::GlobalDecl, clang::ThunkInfo
const&, bool) tools/clang/lib/CodeGen/CGVTables.cpp:456
    #4 0x7f901039fca9 in
clang::CodeGen::CodeGenVTables::EmitThunks(clang::GlobalDecl)
tools/clang/lib/CodeGen/CGVTables.cpp:493
    #5 0x7f9010403c08 in
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl)
tools/clang/lib/CodeGen/CodeGenModule.cpp:1227
    #6 0x7f90103eeeb7 in clang::CodeGen::CodeGenModule::EmitDeferred()
tools/clang/lib/CodeGen/CodeGenModule.cpp:896
    #7 0x7f90103ee5ac in clang::CodeGen::CodeGenModule::Release()
tools/clang/lib/CodeGen/CodeGenModule.cpp:180
    #8 0x7f9010383415 in (anonymous
namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&)
tools/clang/lib/CodeGen/ModuleBuilder.cpp:104
    #9 0x7f901037fa36 in
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
tools/clang/lib/CodeGen/CodeGenAction.cpp:119
    #10 0x7f901136202d in clang::ParseAST(clang::Sema&, bool, bool)
tools/clang/lib/Parse/ParseAST.cpp:153
    #11 0x7f9010f4d3ff in clang::ASTFrontendAction::ExecuteAction()
tools/clang/lib/Frontend/FrontendAction.cpp:470
    #12 0x7f901037b8db in clang::CodeGenAction::ExecuteAction()
tools/clang/lib/CodeGen/CodeGenAction.cpp:423
    #13 0x7f9010f4af2c in clang::FrontendAction::Execute()
tools/clang/lib/Frontend/FrontendAction.cpp:378
    #14 0x7f9010e97455 in
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
tools/clang/lib/Frontend/CompilerInstance.cpp:691
    #15 0x7f90102f2a86 in
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:235
    #16 0x7f900bc29082 in cc1_main(char const**, char const**, char const*,
void*) tools/clang/tools/driver/cc1_main.cpp:98
    #17 0x7f900bc150ea in main tools/clang/tools/driver/driver.cpp:357
    #18 0x7f900a0db76c (/lib/x86_64-linux-gnu/libc.so.6+0x2176c)
    #19 0x7f900bc11d0c (/code/llvm/build_msan/bin/clang-3.3+0x43ed0c)
  Uninitialized value was created by an allocation of 'temp.lvalue73' in the
stack frame of function
'clang::CodeGen::CodeGenVTables::EmitThunk(clang::GlobalDecl, clang::ThunkInfo
const&, bool)'


This can be verified by initializing CalleeWithThisReturn with garbage in
CodeGenFunction::CodeGenFunction(), and verifying that it is still there in
CodeGenFunction::EmitFunctionEpilog.

This code was introduced in r177541.
r178015 fixed a minor issue here, but this time
CGM.getCXXABI().HasThisReturn(CurGD) is true, and this uninitialized value may
actually affect generated code.

-- 
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/20130326/371e69f5/attachment.html>


More information about the llvm-bugs mailing list