<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 --- - Segfault istream.tellg() and unordered_map"
   href="http://llvm.org/bugs/show_bug.cgi?id=21460">21460</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Segfault istream.tellg() and unordered_map
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.5
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>release blocker
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mail@tylor.io
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I get a segfault when calling tellg() on any istream.

#include <string>
#include <sstream>

int main() {
  std::string str = "Hello, world";
  std::istringstream in(str);
  std::string word;
  in >> word;
  int pos = in.tellg();
}

I also get a segfault when trying to insert an element into a unordered_map

#include <unordered_map>

int main() {
  std::unordered_map<int, int> int_map;
  int_map[2] = 3;
}

When I run this through gdb I get this:

Program received signal SIGSEGV, Segmentation fault.
0x000000006fc8cac8 in ?? () from c:\msys64\mingw64\bin\libstdc++-6.dll

I running this on Windows 7 using the mingw64 package via msys2
I don't get this behavior with g++ 4.9.1 or in the mingw32 package of the same
version.

$ clang++ --version
clang version 3.5.0 (tags/RELEASE_350/final)
Target: x86_64-w64-windows-gnu
Thread model: posix

$ uname -a
MINGW64_NT-6.1 tower 2.0.0(0.279/5/3) 2014-10-27 06:58 x86_64 Msys</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>