<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Crash in SmallVector.h from driver while reporting another crash"
   href="http://llvm.org/bugs/show_bug.cgi?id=19515">19515</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash in SmallVector.h from driver while reporting another crash
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Driver
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>douglas_yung@playstation.sony.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>While running clang, I am hitting an assertion failure in the compiler driver
while it is trying to report another crash in the front-end.

Clang information:
-    Host: AMD64
-    Target: AMD64
-    Host OS: Linux (Ubuntu 13.10)
-    SVN Revision: 204763 (This failure has also been observed in revision
206712)

The assert that failed is the following:

clang: /home/snc/llvm/llvm/include/llvm/ADT/SmallVector.h:145: const T&
llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2>
<span class="quote">>::operator[](unsigned int) const [with T = const char*;</span >
<template-parameter-1-2> = void; llvm::SmallVectorTemplateCommon<T,
<template-parameter-1-2> >::const_reference = const char* const&]: Assertion
`begin() + idx < end()' failed.

To reproduce this failure, compile the code from PR19514 (reproduced here for
convenience) with the command line “clang –c repro.cpp –lstdc++”.

struct A { };
struct D { int fld4; };
struct B: virtual D, A { };
struct C: B, A { void vf1 (); };
void C::vf1 () { }

Note that this will produce two assertion failures in the compiler, the first
is in the front-end and is filed as PR19514, and the second is in the driver
which is the subject of this bug.

The crash in the driver produces the following output:


clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.5.0 (trunk 204763)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang: /home/snc/llvm/llvm/include/llvm/ADT/SmallVector.h:145: const T&
llvm::SmallVectorTemplateCommon<T, <template-parameter-1-2>
<span class="quote">>::operator[](unsigned int) const [with T = const char*;</span >
<template-parameter-1-2> = void; llvm::SmallVec
torTemplateCommon<T, <template-parameter-1-2> >::const_reference = const char*
const&]: Assertion `begin() + idx < end()' failed.
0  clang           0x00000000036cd47a llvm::sys::PrintStackTrace(_IO_FILE*) +
38
1  clang           0x00000000036cd6f7
2  clang           0x00000000036cd0ab
3  libpthread.so.0 0x00007fb1e2ac6bb0
4  libc.so.6       0x00007fb1e1d03f77 gsignal + 55
5  libc.so.6       0x00007fb1e1d075e8 abort + 328
6  libc.so.6       0x00007fb1e1cfcd43
7  libc.so.6       0x00007fb1e1cfcdf2
8  clang           0x0000000000e857b1
9  clang           0x0000000000e82574
10 clang           0x0000000000fcd24b
clang::driver::Driver::generateCompilationDiagnostics(clang::driver::Compilation&,
clang::driver::Command const*) + 825
11 clang           0x0000000000e8c70b main + 3672
12 libc.so.6       0x00007fb1e1ceede5 __libc_start_main + 245
13 clang           0x0000000000e7e189
Stack dump:
0.      Program arguments: /home/snc/llvm/build/Debug+Asserts/bin/clang -c
repro.cpp -lstdc++

As an aside, removing the “-lstdc++” seems to prevent this second assert from
happening.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>