[LLVMbugs] [Bug 7892] New: Crash in codegen with __PRETTY_FUNCTION__ in non-constant initializer

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Aug 14 16:03:52 PDT 2010


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

           Summary: Crash in codegen with __PRETTY_FUNCTION__ in
                    non-constant initializer
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: sharparrow1 at yahoo.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Testcase:
int foo(const char*);
int a = foo(__PRETTY_FUNCTION__);

It appears to crash via a null pointer dereference; valgrind trace:
==21518== Invalid read of size 1
==21518==    at 0xB95994: clang::Decl::getTranslationUnitDecl() (in
/home/eli/llvmgbuild/Release+Asserts/bin/clang)
==21518==    by 0xB95A88: clang::Decl::getASTContext() const (in
/home/eli/llvmgbuild/Release+Asserts/bin/clang)
==21518==    by 0xBBA152:
clang::PredefinedExpr::ComputeName(clang::PredefinedExpr::IdentType,
clang::Decl const*) (in /home/eli/llvmgbuild/Release+Asserts/bin/clang)
==21518==    by 0x79CD7D:
clang::CodeGen::CodeGenFunction::EmitPredefinedFunctionName(unsigned int) (in
/home/eli/llvmgbuild/Release+Asserts/bin/clang)
==21518==    by 0x79CF46:
clang::CodeGen::CodeGenFunction::EmitPredefinedLValue(clang::PredefinedExpr
const*) (in /home/eli/llvmgbuild/Release+Asserts/bin/clang)
==21518==    by 0x7A6680:
clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*) (in
/home/eli/llvmgbuild/Release+Asserts/bin/clang)
==21518==    by 0x7CD485: (anonymous
namespace)::ScalarExprEmitter::EmitCastExpr(clang::CastExpr*) (in
/home/eli/llvmgbuild/Release+Asserts/bin/clang)
==21518==    by 0x7CA951: clang::StmtVisitor<(anonymous
namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) (in
/home/eli/llvmgbuild/Release+Asserts/bin/clang)
==21518==    by 0x7CED06:
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (in
/home/eli/llvmgbuild/Release+Asserts/bin/clang)
==21518==    by 0x7A1726:
clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, llvm::Value*,
bool, bool, bool) (in /home/eli/llvmgbuild/Release+Asserts/bin/clang)
==21518==    by 0x7A180D:
clang::CodeGen::CodeGenFunction::EmitAnyExprToTemp(clang::Expr const*, bool,
bool) (in /home/eli/llvmgbuild/Release+Asserts/bin/clang)
==21518==    by 0x7742A0:
clang::CodeGen::CodeGenFunction::EmitCallArg(clang::Expr const*,
clang::QualType) (in /home/eli/llvmgbuild/Release+Asserts/bin/clang)
==21518==  Address 0x1c is not stack'd, malloc'd or (recently) free'd

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list