[LLVMbugs] [Bug 14321] New: r167602 'make check-all' fails in CodeGenCXX/mangle-ms-templates.cpp, built with gcc-4.7.1 for x86_64

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Nov 12 05:17:30 PST 2012


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

             Bug #: 14321
           Summary: r167602 'make check-all' fails in
                    CodeGenCXX/mangle-ms-templates.cpp, built with
                    gcc-4.7.1 for x86_64
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: patrik.h.hagglund at ericsson.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Building a Release+Asserts build with gcc-4.7.1 (but not clang-3.1) on Linux
x86_64 makes make check-all to fail in CodeGenCXX/mangle-ms-templates.cpp.

> valgrind --track-origins=yes /dev/shm/uabpath/master/build-gcc471/Release+Debug+Asserts/bin/clang -cc1 -internal-isystem /dev/shm/uabpath/master/build-gcc471/Release+Debug+Asserts/bin/../lib/clang/3.2/include -fms-extensions -emit-llvm /dev/shm/uabpath/master/tools/clang/test/CodeGenCXX/mangle-ms-templates.cpp -o - -cxx-abi microsoft -triple=i386-pc-win32

==2398== Memcheck, a memory error detector
==2398== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==2398== Using Valgrind-3.8.0 and LibVEX; rerun with -h for copyright info
==2398== Command:
/dev/shm/uabpath/master/build-gcc471/Release+Debug+Asserts/bin/clang -cc1
-internal-isystem
/dev/shm/uabpath/master/build-gcc471/Release+Debug+Asserts/bin/../lib/clang/3.2/include
-fms-extensions -emit-llvm
/dev/shm/uabpath/master/tools/clang/test/CodeGenCXX/mangle-ms-templates.cpp -o
- -cxx-abi microsoft -triple=i386-pc-win32
==2398==
==2398== Conditional jump or move depends on uninitialised value(s)
==2398==    at 0x1235E0B: (anonymous
namespace)::MicrosoftCXXNameMangler::mangleUnqualifiedName(clang::NamedDecl
const*, clang::DeclarationName) (Casting.h:208)
==2398==    by 0x1239DBA: (anonymous
namespace)::MicrosoftCXXNameMangler::manglePostfix(clang::DeclContext const*,
bool) (MicrosoftMangle.cpp:65)
==2398==    by 0x1236F2C: (anonymous
namespace)::MicrosoftCXXNameMangler::mangleName(clang::NamedDecl const*)
(MicrosoftMangle.cpp:303)
==2398==    by 0x1239066: (anonymous
namespace)::MicrosoftCXXNameMangler::mangle(clang::NamedDecl const*,
llvm::StringRef) (MicrosoftMangle.cpp:206)
==2398==    by 0x1239EA2: (anonymous
namespace)::MicrosoftMangleContext::mangleCXXCtor(clang::CXXConstructorDecl
const*, clang::CXXCtorType, llvm::raw_ostream&) (MicrosoftMangle.cpp:1695)
==2398==    by 0x91639E:
clang::CodeGen::CodeGenModule::getMangledName(clang::GlobalDecl)
(CodeGenModule.cpp:390)
==2398==    by 0x948395:
clang::CodeGen::CodeGenModule::GetAddrOfCXXConstructor(clang::CXXConstructorDecl
const*, clang::CXXCtorType, clang::CodeGen::CGFunctionInfo const*)
(CGCXX.cpp:218)
==2398==    by 0x95FD18:
clang::CodeGen::CodeGenFunction::EmitCXXConstructorCall(clang::CXXConstructorDecl
const*, clang::CXXCtorType, bool, llvm::Value*, clang::ConstExprIterator,
clang::ConstExprIterator) (CGClass.cpp:1262)
==2398==    by 0x9A9D3F:
clang::CodeGen::CodeGenFunction::EmitCXXConstructExpr(clang::CXXConstructExpr
const*, clang::CodeGen::AggValueSlot) (CGExprCXX.cpp:509)
==2398==    by 0x9A24D8: (anonymous
namespace)::AggExprEmitter::VisitCXXConstructExpr(clang::CXXConstructExpr
const*) (CGExprAgg.cpp:872)
==2398==    by 0x9A562F: clang::StmtVisitorBase<clang::make_ptr, (anonymous
namespace)::AggExprEmitter, void>::Visit(clang::Stmt*) (StmtNodes.inc:181)
==2398==    by 0x9A61BA:
clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr const*,
clang::CodeGen::AggValueSlot) (CGExprAgg.cpp:1261)
==2398==  Uninitialised value was created by a stack allocation
==2398==    at 0x12357DD: (anonymous
namespace)::MicrosoftCXXNameMangler::mangleUnqualifiedName(clang::NamedDecl
const*, clang::DeclarationName) (MicrosoftMangle.cpp:397)
==2398==
clang: /dev/shm/uabpath/master/include/llvm/Support/Casting.h:208: typename
llvm::cast_retty<To, From>::ret_type llvm::cast(const Y&) [with X =
clang::TemplateSpecializationType; Y = const clang::Type*; typename
llvm::cast_retty<To, From>::ret_type = const
clang::TemplateSpecializationType*]: Assertion `isa<X>(Val) && "cast<Ty>()
argument of inco
mpatible type!"' failed.
0  clang           0x0000000001fe565f
1  clang           0x0000000001fe5b59
2  libpthread.so.0 0x0000000004e3e6a0
3  libc.so.6       0x00000000059fc945 gsignal + 53
4  libc.so.6       0x00000000059fdf21 abort + 385
5  libc.so.6       0x00000000059f5810 __assert_fail + 240
6  clang           0x000000000072fbdc
7  clang           0x00000000012369dc
8  clang           0x0000000001239dbb
9  clang           0x0000000001236f2d
10 clang           0x0000000001239067
11 clang           0x0000000001239ea3
12 clang           0x000000000091639f
clang::CodeGen::CodeGenModule::getMangledName(clang::GlobalDecl) + 1599
13 clang           0x0000000000948396
clang::CodeGen::CodeGenModule::GetAddrOfCXXConstructor(clang::CXXConstructorDecl
const*, clang::CXXCtorType, clang::CodeGen::CGFunctionInfo const*) + 86
14 clang           0x000000000095fd19
clang::CodeGen::CodeGenFunction::EmitCXXConstructorCall(clang::CXXConstructorDecl
const*, clang::CXXCtorType, bool, llvm::Value*, clang::ConstExprIterator,
clang::ConstExprIterator) + 377
15 clang           0x00000000009a9d40
clang::CodeGen::CodeGenFunction::EmitCXXConstructExpr(clang::CXXConstructExpr
const*, clang::CodeGen::AggValueSlot) + 576
16 clang           0x00000000009a24d9
17 clang           0x00000000009a5630
18 clang           0x00000000009a61bb
clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr const*,
clang::CodeGen::AggValueSlot) + 587
19 clang           0x000000000097d088
clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const*,
clang::ValueDecl const*, clang::CodeGen::LValue, bool) + 760
20 clang           0x000000000097e839
clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission
const&) + 1401
21 clang           0x0000000000980181
clang::CodeGen::CodeGenFunction::EmitAutoVarDecl(clang::VarDecl const&) + 33
22 clang           0x0000000000a1f847
clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) + 71
23 clang           0x0000000000a26775
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 245
24 clang           0x0000000000a23be7
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 39
25 clang           0x0000000000a2408f
clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&,
bool, clang::CodeGen::AggValueSlot) + 239
26 clang           0x0000000000a26752
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 210
27 clang           0x0000000000a23be7
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 39
28 clang           0x0000000000a34c99
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 777
29 clang           0x0000000000916a89
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl)
+ 745
30 clang           0x00000000009232c3
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 467
31 clang           0x00000000009236fa
clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 778
32 clang           0x0000000000924734
33 clang           0x00000000009087ec
34 clang           0x0000000000907db6
35 clang           0x0000000000a50559 clang::ParseAST(clang::Sema&, bool, bool)
+ 297
36 clang           0x0000000000907024 clang::CodeGenAction::ExecuteAction() +
68
37 clang           0x00000000007abb33 clang::FrontendAction::Execute() + 131
38 clang           0x000000000078f2b9
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 329
39 clang           0x0000000000776a55
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1413
40 clang           0x000000000076eac8 cc1_main(char const**, char const**, char
const*, void*) + 1176
41 clang           0x0000000000775e52 main + 4834
42 libc.so.6       0x00000000059e8bc6 __libc_start_main + 230
43 clang           0x000000000076d991
Stack dump:
0.      Program arguments:
/dev/shm/uabpath/master/build-gcc471/Release+Debug+Asserts/bin/clang -cc1
-internal-isystem
/dev/shm/uabpath/master/build-gcc471/Release+Debug+Asserts/bin/../lib/clang/3.2/include
-fms-extensions -emit-llvm
/dev/shm/uabpath/master/tools/clang/test/CodeGenCXX/mangle-ms-templates.cpp -o
- -cxx-abi microsoft -triple=i386-p
c-win32
1.     
/dev/shm/uabpath/master/tools/clang/test/CodeGenCXX/mangle-ms-templates.cpp:73:1:
current parser token 'namespace'
2.     
/dev/shm/uabpath/master/tools/clang/test/CodeGenCXX/mangle-ms-templates.cpp:33:6:
LLVM IR generation of declaration 'template_mangling'
3.     
/dev/shm/uabpath/master/tools/clang/test/CodeGenCXX/mangle-ms-templates.cpp:33:6:
Generating code for declaration 'template_mangling'
4.     
/dev/shm/uabpath/master/tools/clang/test/CodeGenCXX/mangle-ms-templates.cpp:33:26:
LLVM IR generation of compound statement ('{}')

(gdb) bt
#0  0x00007ffff6f17945 in raise () from /lib64/libc.so.6
#1  0x00007ffff6f18f21 in abort () from /lib64/libc.so.6
#2  0x00007ffff6f10810 in __assert_fail () from /lib64/libc.so.6
#3  0x000000000072fbdc in llvm::cast<clang::TemplateSpecializationType,
clang::Type const*> (Val=<optimized out>) at
/dev/shm/uabpath/master/include/llvm/Support/Casting.h:208
#4  0x00000000012369dc in doit (Val=<optimized out>) at
/dev/shm/uabpath/master/include/llvm/Support/Casting.h:86
#5  doit (Val=<optimized out>) at
/dev/shm/uabpath/master/include/llvm/Support/Casting.h:113
#6  isa<clang::TemplateSpecializationType, clang::Type const*> (Val=<optimized
out>) at /dev/shm/uabpath/master/include/llvm/Support/Casting.h:124
#7  cast<clang::TemplateSpecializationType, clang::Type const*> (Val=<optimized
out>) at /dev/shm/uabpath/master/include/llvm/Support/Casting.h:208
#8  getTypePtr (this=0x7fffffff9860) at
/dev/shm/uabpath/master/tools/clang/lib/AST/../../include/clang/AST/TypeLoc.h:308
#9  getNumArgs (this=0x7fffffff9860) at
/dev/shm/uabpath/master/tools/clang/lib/AST/../../include/clang/AST/TypeLoc.h:1270
#10 isTemplate (TemplateArgs=..., ND=0x325af00) at
/dev/shm/uabpath/master/tools/clang/lib/AST/MicrosoftMangle.cpp:379
#11 (anonymous namespace)::MicrosoftCXXNameMangler::mangleUnqualifiedName
(this=this at entry=0x7fffffff9d30, ND=0x325af00, Name=...) at
/dev/shm/uabpath/master/tools/clang/lib/AST/MicrosoftMangle.cpp:404
#12 0x0000000001239dbb in mangleUnqualifiedName (ND=<optimized out>,
this=0x7fffffff9d30) at
/dev/shm/uabpath/master/tools/clang/lib/AST/MicrosoftMangle.cpp:65
#13 (anonymous namespace)::MicrosoftCXXNameMangler::manglePostfix
(this=0x7fffffff9d30, DC=0x325af38, NoFunction=false) at
/dev/shm/uabpath/master/tools/clang/lib/AST/MicrosoftMangle.cpp:541
#14 0x0000000001236f2d in (anonymous
namespace)::MicrosoftCXXNameMangler::mangleName (this=0x7fffffff9d30,
ND=0x325b260) at
/dev/shm/uabpath/master/tools/clang/lib/AST/MicrosoftMangle.cpp:303
#15 0x0000000001239067 in (anonymous
namespace)::MicrosoftCXXNameMangler::mangle (this=this at entry=0x7fffffff9d30,
D=0x325b260, Prefix=...) at
/dev/shm/uabpath/master/tools/clang/lib/AST/MicrosoftMangle.cpp:206
#16 0x0000000001239ea3 in (anonymous
namespace)::MicrosoftMangleContext::mangleCXXCtor (this=<optimized out>,
D=<optimized out>, Type=<optimized out>, Out=...) at
/dev/shm/uabpath/master/tools/clang/lib/AST/MicrosoftMangle.cpp:1695
#17 0x000000000091639f in clang::CodeGen::CodeGenModule::getMangledName
(this=0x3242a10, GD=...) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/CodeGenModule.cpp:390
#18 0x0000000000948396 in
clang::CodeGen::CodeGenModule::GetAddrOfCXXConstructor (this=0x3242a10,
ctor=0x325b260, ctorType=clang::Ctor_Complete, fnInfo=0x0) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/CGCXX.cpp:218
#19 0x000000000095fd19 in
clang::CodeGen::CodeGenFunction::EmitCXXConstructorCall (this=0x7fffffffac20,
D=0x325b260, Type=clang::Ctor_Complete, ForVirtualBase=false, This=0x32690a8,
ArgBeg=..., ArgEnd=...) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/CGClass.cpp:1262
#20 0x00000000009a9d40 in clang::CodeGen::CodeGenFunction::EmitCXXConstructExpr
(this=0x7fffffffac20, E=0x325f7c0, Dest=...) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/CGExprCXX.cpp:509
#21 0x00000000009a24d9 in (anonymous
namespace)::AggExprEmitter::VisitCXXConstructExpr
(this=this at entry=0x7fffffffa520, E=E at entry=0x325f7c0) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/CGExprAgg.cpp:872
#22 0x00000000009a5630 in Visit (S=0x325f7c0, this=0x7fffffffa520) at
/dev/shm/uabpath/master/build-gcc471/tools/clang/lib/CodeGen/../../include/clang/AST/StmtNodes.inc:181
#23 clang::StmtVisitorBase<clang::make_ptr, {anonymous}::AggExprEmitter,
void>::Visit(clang::make_ptr<clang::Stmt>::type) (this=0x7fffffffa520,
S=0x325f7c0) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/../../include/clang/AST/StmtVisitor.h:38
#24 0x00000000009a61bb in clang::CodeGen::CodeGenFunction::EmitAggExpr
(this=0x7fffffffac20, E=0x325f7c0, Slot=...) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/CGExprAgg.cpp:1261
#25 0x000000000097d088 in clang::CodeGen::CodeGenFunction::EmitExprAsInit
(this=this at entry=0x7fffffffac20, init=init at entry=0x325f7c0,
D=D at entry=0x325f590, lvalue=..., capturedByInit=capturedByInit at entry=false) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/CGDecl.cpp:1127
#26 0x000000000097e839 in clang::CodeGen::CodeGenFunction::EmitAutoVarInit
(this=this at entry=0x7fffffffac20, emission=...) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/CGDecl.cpp:1046
#27 0x0000000000980181 in clang::CodeGen::CodeGenFunction::EmitAutoVarDecl
(this=0x7fffffffac20, D=...) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/CGDecl.cpp:773
#28 0x0000000000a1f847 in clang::CodeGen::CodeGenFunction::EmitDeclStmt
(this=0x7fffffffac20, S=...) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/CGStmt.cpp:809
#29 0x0000000000a26775 in clang::CodeGen::CodeGenFunction::EmitSimpleStmt
(this=<optimized out>, S=<optimized out>) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/CGStmt.cpp:176
#30 0x0000000000a23be7 in clang::CodeGen::CodeGenFunction::EmitStmt
(this=0x7fffffffac20, S=0x325f7f0) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/CGStmt.cpp:47
#31 0x0000000000a2408f in clang::CodeGen::CodeGenFunction::EmitCompoundStmt
(this=0x7fffffffac20, S=..., GetLast=GetLast at entry=false, AggSlot=...) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/CGStmt.cpp:203
#32 0x0000000000a26752 in clang::CodeGen::CodeGenFunction::EmitSimpleStmt
(this=<optimized out>, S=<optimized out>) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/CGStmt.cpp:175
#33 0x0000000000a23be7 in clang::CodeGen::CodeGenFunction::EmitStmt
(this=0x7fffffffac20, S=0x32636b8) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/CGStmt.cpp:47
#34 0x0000000000a34c99 in clang::CodeGen::CodeGenFunction::GenerateCode
(this=0x7fffffffac20, GD=..., Fn=0x3262ad0, FnInfo=...) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/CodeGenFunction.cpp:538
#35 0x0000000000916a89 in
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition
(this=this at entry=0x3242a10, GD=GD at entry=...) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/CodeGenModule.cpp:1955
#36 0x00000000009232c3 in clang::CodeGen::CodeGenModule::EmitGlobalDefinition
(this=this at entry=0x3242a10, GD=...) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/CodeGenModule.cpp:1089
#37 0x00000000009236fa in clang::CodeGen::CodeGenModule::EmitGlobal
(this=this at entry=0x3242a10, GD=...) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/CodeGenModule.cpp:965
#38 0x0000000000924734 in clang::CodeGen::CodeGenModule::EmitTopLevelDecl
(this=0x3242a10, D=0x325b620) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/CodeGenModule.cpp:2626
#39 0x00000000009087ec in (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl (this=0x3225820, DG=...) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/ModuleBuilder.cpp:69
#40 0x0000000000907db6 in clang::BackendConsumer::HandleTopLevelDecl
(this=0x32256b0, D=...) at
/dev/shm/uabpath/master/tools/clang/lib/CodeGen/CodeGenAction.cpp:105
#41 0x0000000000a50559 in clang::ParseAST (S=..., PrintStats=false,
SkipFunctionBodies=<optimized out>) at
/dev/shm/uabpath/master/tools/clang/lib/Parse/ParseAST.cpp:99
#42 0x0000000000907024 in clang::CodeGenAction::ExecuteAction (this=0x31f69b0)
at /dev/shm/uabpath/master/tools/clang/lib/CodeGen/CodeGenAction.cpp:423
#43 0x00000000007abb33 in clang::FrontendAction::Execute (this=0x31f69b0) at
/dev/shm/uabpath/master/tools/clang/lib/Frontend/FrontendAction.cpp:383
#44 0x000000000078f2b9 in clang::CompilerInstance::ExecuteAction
(this=0x31f5cb0, Act=...) at
/dev/shm/uabpath/master/tools/clang/lib/Frontend/CompilerInstance.cpp:688
#45 0x0000000000776a55 in clang::ExecuteCompilerInvocation (Clang=0x31f5cb0) at
/dev/shm/uabpath/master/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:189
#46 0x000000000076eac8 in cc1_main (ArgBegin=0x7fffffffc968,
ArgEnd=0x7fffffffc9b8, Argv0=0x31f5698
"/dev/shm/uabpath/master/build-gcc471/Release+Debug+Asserts/bin/clang",
MainAddr=0x771f80 <GetExecutablePath(char const*, bool)>) at
/dev/shm/uabpath/master/tools/clang/tools/driver/cc1_main.cpp:91
#47 0x0000000000775e52 in main (argc_=<optimized out>, argv_=<optimized out>)
at /dev/shm/uabpath/master/tools/clang/tools/driver/driver.cpp:358


The error report from valgrind seems to be related to stack item 10 above, i.e.
TSTL at MicrosoftMangle.cpp:379 seems to be unitilialized.

-- 
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