Skip to content
Snippets Groups Projects
Sam Yates's avatar
Sam Yates authored
Addresses in part issue #113.

* Make compatibility wrappers/functions that dance around xlC
  bugs. Wrappers are provied in `util/compat.hpp` and live in
  the `compat` namespace.
      - `compat::end` reimplements `std::end` but in a way that
	apparently does not trigger the xlC bug.
      - `compat::compiler_barrier_if_xlc_leq()` inserts a compiler
	reordering barrier if the compiler is xlC and the version
	less than or equal to that specified. Name is deliberately
	verbose.
      - `compat::isinf()` is an inline wrapper around `std::isinf()`,
	which apparently is sufficient to defuse an evaluation
	order bug with `std::isinf()` in switch statements.
* Use `compat::compiler_barrier_if_xlc_leq()` in `util::unitialized`
  reference access methods to avoid improper reordering with -O2.
* Use `compat::isinf()` in `test_math.cpp` to defuse improper
  reordering within `EXPECT_EQ` gtest macro of `std::isinf()`.
* Use `compat::end()` in `util::back()` and `util::cend()` to avoid
  incorrect `std::end()` behaviour with -O2.
* Use `util::cend()` in `algorithms::sum()`, again to avoid
  incorrect `std::end()` behaviour with -O2.
d73f2240
Name Last commit Last update