[LLVMbugs] [Bug 8706] New: Assertion `Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"' failed.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 30 04:26:06 PST 2010


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

           Summary: Assertion `Ty->isSized() && "Cannot getTypeInfo() on a
                    type that is unsized!"' failed.
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: hans at chromium.org
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


(Sorry for the bad summary; anyone who has a better idea of what's going on,
feel free to change it.)

Compiling the code below with clang++ built from trunk r120423 on
x86_64-unknown-linux-gnu fails an assert:


template <typename T> class RefPtr {
 public:
  RefPtr() : m_ptr(0) {}
  typedef T *(RefPtr::*UnspecifiedBoolType);
  operator UnspecifiedBoolType() const {
    return m_ptr ? &RefPtr::m_ptr : 0;
  }
 private:
  T *m_ptr;
};

class C {};
class D {};

template <typename T> class Handle { T *val_; };

Handle<D> someFunction() {
  RefPtr <C> rp;
  bool b = rp;
}

void f() {
  (void) &someFunction;
}


clang: TargetData.cpp:495: unsigned int llvm::TargetData::getAlignment(const
llvm::Type*, bool) const: Assertion `Ty->isSized() && "Cannot getTypeInfo() on
a type that is unsized!"' failed.
0  clang           0x00000000016a955f
1  clang           0x00000000016ab7d2
2  libpthread.so.0 0x00007f6a6d29d8f0
3  libc.so.6       0x00007f6a6c58ca75 gsignal + 53
4  libc.so.6       0x00007f6a6c5905c0 abort + 384
5  libc.so.6       0x00007f6a6c585941 __assert_fail + 241
6  clang           0x0000000001550277 llvm::TargetData::getAlignment(llvm::Type
const*, bool) const + 311
7  clang           0x000000000154fc3b
llvm::StructLayout::StructLayout(llvm::StructType const*, llvm::TargetData
const&) + 267
8  clang           0x0000000001550072
llvm::TargetData::getStructLayout(llvm::StructType const*) const + 882
9  clang           0x00000000007862b7
10 clang           0x00000000007e0240
clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(clang::DeclRefExpr const*) +
1584
11 clang           0x00000000007e300e
clang::CodeGen::CodeGenFunction::EmitLValue(clang::Expr const*) + 782
12 clang           0x0000000000809205
13 clang           0x000000000080fd5b
14 clang           0x0000000000809e9c
15 clang           0x000000000080a917
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 87
16 clang           0x000000000085a131
clang::CodeGen::CodeGenFunction::EmitReturnStmt(clang::ReturnStmt const&) + 833
17 clang           0x0000000000860b08
clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&,
bool, clang::CodeGen::AggValueSlot) + 264
18 clang           0x0000000000860da6
clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) + 262
19 clang           0x000000000085dc82
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 34
20 clang           0x0000000000881ff9
clang::CodeGen::CodeGenFunction::GenerateCode(clang::CodeGen::GlobalDecl,
llvm::Function*) + 617
21 clang           0x000000000077acd6
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::CodeGen::GlobalDecl)
+ 678
22 clang           0x000000000077b7a2
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::CodeGen::GlobalDecl)
+ 194
23 clang           0x000000000077c7b7
clang::CodeGen::CodeGenModule::EmitDeferred() + 151
24 clang           0x000000000077c839 clang::CodeGen::CodeGenModule::Release()
+ 9
25 clang           0x000000000076d4f8
26 clang           0x000000000089bc94 clang::ParseAST(clang::Sema&, bool) + 292
27 clang           0x000000000076e454 clang::CodeGenAction::ExecuteAction() +
68
28 clang           0x00000000006682d5
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 357
29 clang           0x00000000006475ac
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1260
30 clang           0x000000000063f385 cc1_main(char const**, char const**, char
const*, void*) + 693
31 clang           0x0000000000646567 main + 4183
32 libc.so.6       0x00007f6a6c577c4d __libc_start_main + 253
33 clang           0x000000000063da99
Stack dump:
0.    Program arguments: /work/llvm/Release+Asserts/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
a.cc -mrelocation-model static -mdisable-fp-elim -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.20.1 -resource-dir /work/llvm/Release+Asserts/bin/../lib/clang/2.9
-ferror-limit 19 -fmessage-length 141 -fexceptions -fgnu-runtime
-fdiagnostics-show-option -fcolor-diagnostics -o a.o -x c++ /tmp/a.cc 
1.    <eof> parser at end of file
2.    Per-file LLVM IR generation
3.    /tmp/a.cc:7:3: Generating code for declaration 'RefPtr<C>::operator class
C *class RefPtr<class C>::*'
4.    /tmp/a.cc:7:40: LLVM IR generation of compound statement ('{}')
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal 1 (use -v to see
invocation)

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