[LLVMbugs] [Bug 12916] New: Clang crashes with std::istreambuf_iterator

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 22 21:57:21 PDT 2012


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

             Bug #: 12916
           Summary: Clang crashes with std::istreambuf_iterator
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: wlynch at wlynch.cx
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8621
  --> http://llvm.org/bugs/attachment.cgi?id=8621
Source code that causes the crash.

Hi all,

The following piece of code crashes with the following assertion:

clang: SplitKit.cpp:373: llvm::VNInfo* llvm::SplitEditor::defValue(unsigned
int, const llvm::VNInfo*, llvm::SlotIndex): Assertion
`Edit->getParent().getVNInfoAt(Idx) == ParentVNI && "Bad Parent VNI"' failed.

The code is essentially:

int main() {
    std::string(std::istreambuf_iterator<char>(),
std::istreambuf_iterator<char>());
}


The code works correctly on clang 3.0 with -O0, -O1, -O2 and -O3.
The code fails on clang 3.1 when in -O2 or -O3.

The full diagnostic is:

clang: SplitKit.cpp:373: llvm::VNInfo* llvm::SplitEditor::defValue(unsigned
int, const llvm::VNInfo*, llvm::SlotIndex): Assertion
`Edit->getParent().getVNInfoAt(Idx) == ParentVNI && "Bad Parent VNI"' failed.
0  clang           0x0000000002342abf
1  clang           0x00000000023437d7
2  libpthread.so.0 0x0000003bfbc0ebe0
3  libc.so.6       0x0000003bfac30285 gsignal + 53
4  libc.so.6       0x0000003bfac31d30 abort + 272
5  libc.so.6       0x0000003bfac29706 __assert_fail + 246
6  clang           0x0000000001d860cb llvm::SplitEditor::defValue(unsigned int,
llvm::VNInfo const*, llvm::SlotIndex) + 139
7  clang           0x0000000001d86aa3 llvm::SplitEditor::defFromParent(unsigned
int, llvm::VNInfo*, llvm::SlotIndex, llvm::MachineBasicBlock&,
llvm::MachineBasicBlock::bundle_iterator<llvm::MachineInstr,
llvm::ilist_iterator<llvm::MachineInstr> >) + 547
8  clang           0x0000000001d88788
llvm::SplitEditor::leaveIntvAfter(llvm::SlotIndex) + 296
9  clang           0x0000000001d89f7d
llvm::SplitEditor::splitRegInBlock(llvm::SplitAnalysis::BlockInfo const&,
unsigned int, llvm::SlotIndex) + 621
10 clang           0x0000000001d3c2aa
11 clang           0x0000000001d3de86
12 clang           0x0000000001d43561
13 clang           0x0000000001d43a38
14 clang           0x0000000001e46754 llvm::RegAllocBase::allocatePhysRegs() +
324
15 clang           0x0000000001d3f15f
16 clang           0x0000000001cf0055
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 53
17 clang           0x000000000227b3a4
llvm::FPPassManager::runOnFunction(llvm::Function&) + 596
18 clang           0x000000000227b43d
llvm::FPPassManager::runOnModule(llvm::Module&) + 45
19 clang           0x000000000227aefc
llvm::MPPassManager::runOnModule(llvm::Module&) + 556
20 clang           0x000000000227b04f llvm::PassManagerImpl::run(llvm::Module&)
+ 159
21 clang           0x000000000227b13d llvm::PassManager::run(llvm::Module&) +
13
22 clang           0x0000000000824c5c
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*,
clang::BackendAction, llvm::raw_ostream*) + 1388
23 clang           0x00000000008221b3
24 clang           0x00000000009dd029 clang::ParseAST(clang::Sema&, bool, bool)
+ 489
25 clang           0x0000000000820382 clang::CodeGenAction::ExecuteAction() +
66
26 clang           0x00000000006711db
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 331
27 clang           0x00000000006510be
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1166
28 clang           0x00000000006479bf cc1_main(char const**, char const**, char
const*, void*) + 1519
29 clang           0x000000000064fe96 main + 4054
30 libc.so.6       0x0000003bfac1d994 __libc_start_main + 244
31 clang           0x0000000000645dd9
Stack dump:
0.    Program arguments: /opt/llvm/3.1/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name main.cpp
-mrelocation-model static -masm-verbose -mconstructor-aliases -munwind-tables
-target-cpu x86-64 -target-linker-version 2.17.50.0.6 -momit-leaf-frame-pointer
-resource-dir /opt/llvm/3.1/bin/../lib/clang/3.1 -fmodule-cache-path
/var/tmp/clang-module-cache -internal-isystem
/usr/lib/gcc/x86_64-redhat-linux6E/4.4.6/../../../../include/c++/4.4.6
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux6E/4.4.6/../../../../include/c++/4.4.6/x86_64-redhat-linux6E
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux6E/4.4.6/../../../../include/c++/4.4.6/backward
-internal-isystem /usr/local/include -internal-isystem
/opt/llvm/3.1/bin/../lib/clang/3.1/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O3 -fdeprecated-macro
-fdebug-compilation-dir /tmp/test -ferror-limit 19 -fmessage-length 199
-mstackrealign -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak
-fobjc-fragile-abi -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/main-agi1C5.o -x c++ main.cpp 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'main.cpp'.
4.    Running pass 'Greedy Register Allocator' on function
'@_ZNSs12_S_constructISt19istreambuf_iteratorIcSt11char_traitsIcEEEEPcT_S5_RKSaIcESt18input_iterator_tag'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
information.
clang: note: diagnostic msg: Preprocessed source(s) and associated run
script(s) are located at:
clang: note: diagnostic msg: /tmp/main-nFUV2b.ii
clang: note: diagnostic msg: /tmp/main-nFUV2b.sh

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