[LLVMbugs] [Bug 6621] New: Assertion in boost code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 15 07:28:58 PDT 2010


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

           Summary: Assertion in boost code
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: chris at bubblescope.net
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


The following code causes an assert in the compiler. It is extracted from boost
and compiles fine on g++. The problem goes away if the
__attribute__((noreturn)) is removed, or the static member of
failed_rangecheck.

Code:

namespace std {

    template<typename _CharT>     class basic_string     {
        public:       inline       basic_string();
    };
    typedef basic_string<char> string;
}
namespace boost {
    template<class E> __attribute__((noreturn)) inline void throw_exception( E
const & e );
    template<class T, int N>     struct array {
        static T failed_rangecheck () {
            boost::throw_exception(1);
            static T placeholder;
        }
    };
}
int main() {
    boost::array<std::string, 0> x;
    x.failed_rangecheck();
}

Backtrace:

~/temp2$ clang++ t.cc -c
While deleting: label %init.check
Use still stuck around after Def is destroyed:  br i1 %tobool, label
%init.check, label %init.end
Assertion failed: (use_empty() && "Uses remain when a value is destroyed!"),
function ~Value, file Value.cpp, line 75.
0  clang             0x00f16125 PrintStackTrace(void*) + 45
1  clang             0x00f1672d SignalHandler(int) + 410
2  libSystem.B.dylib 0x94ee29bb _sigtramp + 43
3  libSystem.B.dylib 0xffffffff _sigtramp + 1796331119
4  libSystem.B.dylib 0x94f7098d raise + 26
5  libSystem.B.dylib 0x94f86a44 abort + 93
6  libSystem.B.dylib 0x94f735ec __pthread_markcancel + 0
7  clang             0x00eae547 llvm::Value::~Value() + 445
8  clang             0x00df3b85 llvm::BasicBlock::~BasicBlock() + 407
9  clang             0x00e3e27e
llvm::ilist_node_traits<llvm::BasicBlock>::deleteNode(llvm::BasicBlock*) + 30
10 clang             0x00e3e8e4 llvm::iplist<llvm::BasicBlock,
llvm::ilist_traits<llvm::BasicBlock>
>::erase(llvm::ilist_iterator<llvm::BasicBlock>) + 32
11 clang             0x00df39ae llvm::BasicBlock::eraseFromParent() + 60
12 clang             0x00be445a (anonymous
namespace)::UnreachableBlockElim::runOnFunction(llvm::Function&) + 646
13 clang             0x00e8bded
llvm::FPPassManager::runOnFunction(llvm::Function&) + 275
14 clang             0x00e8da38
llvm::FunctionPassManagerImpl::run(llvm::Function&) + 80
15 clang             0x00e8dc09 llvm::FunctionPassManager::run(llvm::Function&)
+ 135
16 clang             0x00044b0a (anonymous
namespace)::BackendConsumer::EmitAssembly() + 728
17 clang             0x00044bef (anonymous
namespace)::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 151
18 clang             0x0024c1b8 clang::ParseAST(clang::Preprocessor&,
clang::ASTConsumer*, clang::ASTContext&, bool, bool,
clang::CodeCompleteConsumer*) + 832
19 clang             0x0006306f clang::ASTFrontendAction::ExecuteAction() + 269
20 clang             0x0006317a clang::FrontendAction::Execute() + 260
21 clang             0x00047a83
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 851
22 clang             0x000294c6 cc1_main(char const**, char const**, char
const*, void*) + 1514
23 clang             0x0002cf37 main + 272
24 clang             0x000282cd start + 53
25 clang             0x0000001c start + 4294802820
Stack dump:
0.    Program arguments: /usr/local/bin/clang -cc1 -triple
i386-apple-darwin10.0.0 -S -disable-free -main-file-name t.cc -pic-level 1
-mdisable-fp-elim -target-cpu yonah -resource-dir /usr/local/lib/clang/1.1
-fmessage-length 116 -stack-protector 1 -fblocks -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o
/var/folders/M8/M86fCFVgGQ0r-V2oY5lLC++++TI/-Tmp-/cc-mvuXdZ.s -x c++ t.cc 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Remove unreachable blocks from the CFG' on function
'@_ZN5boost5arrayISbIcELi0EE17failed_rangecheckEv'
clang: error: compiler command failed due to signal 6 (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