V1301. The 'throw' keyword cannot be used outside of a try..catch block in a parallel section

The analyzer found an error relating to throwing an exception from a parallel block. According to OpenMP specification, if you use exceptions inside a parallel block all these exceptions should be processed inside this block. The example given below leads to incorrect program's behavior and most likely to a program crash:

void foo1301(const char **strings, ptrdiff_t n)
{
  #pragma omp parallel for
  for (ptrdiff_t i = 0; i < n; i++)
  {
    if (!strings[i])
      throw MyException();
    DoSomething(strings[i]);
  }
}

Correction of the code lies in processing exceptions inside the parallel block and transferring the information about the error through other mechanisms. Below are given two variants of the corrected function:

void foo1301_fixed1(const char **strings, ptrdiff_t n)
{
  ptrdiff_t errCount = 0;
  #pragma omp parallel for reduction(+: errCount)
  for (ptrdiff_t i = 0; i < n; i++)
  {
    try
    {
      if (!strings[i])
        throw MyException();
      DoSomething(strings[i]);
    }
    catch (MyException &)
    {
      #pragma omp atomic
      ++errCount;
    }
  }
  if (errCount != 0)
    throw MyException();
}
void foo1301_fixed2(const char **strings, ptrdiff_t n)
{
  size_t errCount = 0;
  #pragma omp parallel for reduction(+: errCount)
  for (ptrdiff_t i = 0; i < n; i++)
  {
    if (!strings[i])
      ++errCount;
    else
      DoSomething(strings[i]);
  }
  if (errCount != 0)
    throw MyException();
}