<html>
    <head>
      <base href="https://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 --- - long double representation causes Segmentation fault"
   href="https://llvm.org/bugs/show_bug.cgi?id=24398">24398</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>long double representation causes Segmentation fault
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.6
          </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>normal
          </td>
        </tr>

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

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

        <tr>
          <th>Assignee</th>
          <td>martellmalone@gmail.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>taenaru@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hello,

I have met an issue with segmentation fault in program which was built by
clang.
 Here is the code which represents the bug:

#include <iostream>                         
#include <string>                           

int main() {                                
    char *ptr;                              
    const char *s = "1.23";                         
    long double ld = std::strtold(s, &ptr);                                     
    std::cout << ld;

    return 0;                               
}                                                                       

With the current  g++ (5.2.0)  there is no problem, but clang has. 
 I use clang from mingw64 repo:
clang version 3.6.2 (tags/RELEASE_362/final)
Target: x86_64-w64-windows-gnu
Thread model: posix


I also tried to build the latest available clang , but it has the same effect:
clang version 3.8.0 (trunk)
Target: x86_64-w64-windows-gnu
Thread model: posix

And I also found one more case when clang++ gives  Segmentation fault  error:

#include <sstream>
#include <iostream>

long double foo(long double v) {
    std::stringstream ss;

    ss << v;

    ss.precision(6);

    ss >> v;

    return v;
}

int main() {
    long double a = 10.1238127638712638;

    std::cout << foo(a) << std::endl;

    return 0;
}</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>