[llvm-bugs] [Bug 25533] New: clang-cl producing crashing executable due to exception handling

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Nov 15 00:52:42 PST 2015


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

            Bug ID: 25533
           Summary: clang-cl producing crashing executable due to
                    exception handling
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ismail at i10z.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Using clang r253159, the code itself does not use exception handling itself:

#include <cmath>
#include <iostream>

using namespace std;

unsigned int f2(double x)
{
  double result = 0.0133333 * pow(x, 3) - 0.8 * pow(x, 2) + 21.6667 * x + 90;

  return static_cast<unsigned int>(result);
}

int main()
{
  double input;

  while (1) {
    cout << "Enter a value: ";
    cin >> input;
    cout << "Calculated: " << f2(input) << endl;
  }

  return 0;
}

λ clang-cl /EHsc -fmsc-version=19 test.cpp
λ ./test.exe
zsh: segmentation fault  ./test.exe

Remove /EHsc and its fine:

λ clang-cl -fmsc-version=19 test.cpp
λ ./test.exe
Enter a value:
^C

Using VS2015 on Win10 x64.

-- 
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/20151115/48d5b124/attachment.html>


More information about the llvm-bugs mailing list