CarpetLib's prolongate_3d_rf2 contains non thread safe self-test

Create issue
Issue #1383 new
Roland Haas created an issue

the prolongate_3d_rf2 template in prolongate_3d_rf2.cc line 502ff:

  template <typename T, int ORDER>
  void
  prolongate_3d_rf2 (T const * restrict const src,
                     ivect3 const & restrict srcpadext,
                     ivect3 const & restrict srcext,
                     T * restrict const dst,
                     ivect3 const & restrict dstpadext,
                     ivect3 const & restrict dstext,
                     ibbox3 const & restrict srcbbox,
                     ibbox3 const & restrict dstbbox,
                     ibbox3 const & restrict,
                     ibbox3 const & restrict regbbox,
                     void * extraargs)
  {
    assert (not extraargs);

    static_assert (ORDER>=0 and ORDER % 2 == 1,
                   "ORDER must be non-negative and odd");

    typedef typename typeprops<T>::real RT;
    coeffs1d<RT,ORDER>::test();

contain a call to the self-test routine test() which is not thread safe (since it uses a static variable without protection).

As far as I can tell one can simply remove the test from this location since it is already explicitly triggered in the scheduled routine CarpetLib_test_prolongate_3d_rf2 above so would not ever actually execute anyway since the static has long been set to true by the time of the first "real" call to the operator. Similar code might exist for the other operators.

Keyword:

Comments (0)

  1. Log in to comment