<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 --- - clang-cl producing crashing executable due to exception handling"
   href="https://llvm.org/bugs/show_bug.cgi?id=25533">25533</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang-cl producing crashing executable due to exception handling
          </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>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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ismail@i10z.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>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.</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>