[llvm-bugs] [Bug 24398] New: long double representation causes Segmentation fault

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Aug 8 00:58:15 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24398

            Bug ID: 24398
           Summary: long double representation causes Segmentation fault
           Product: clang
           Version: 3.6
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: martellmalone at gmail.com
          Reporter: taenaru at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150808/1ec5facb/attachment.html>


More information about the llvm-bugs mailing list