-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: isolate and work around xlC++ compilation-related issues. [4] #113
Comments
Isolated
Draft issue reports below. |
Issue
Consider the following source:
Running the executable produced with -O0 behaves as expected (no assertion); with -O2, the
WorkaroundWriting and using a substitute generic 'end' function produces correct results, but this Example:
Compiler version information
|
IssueInternal compiler error when compiling the file below:
Demo:
WorkaroundUsing a default-constructed vector as the default argument avoids the ICE, e.g.
Compiler version information
|
IssueAssertion fails when running the compiled form of the code below with -O2, or with -O2 -qalias=addrtaken:
Expected behaviour is for the assertion not to fail: following the call to A major point of utility for the Note that substituting the declaration of data with
exhibits the same behaviour. Demo:
WorkaroundCompiling with
Alternatively, adding an explicit compiler barrier also forces correct behaviour:
Compiler version information
|
Issue
Example source:
Running the executable produced with -O0 generates an assertion failure; with -O1 or -O2, no assertion is generated, as expected:
WorkaroundAssigning the result of
Compiler version information
|
Addresses in part issue arbor-sim#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.
Addresses in part issue arbor-sim#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.
Addresses in part issue arbor-sim#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.
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.
Been in discussion with Bastian Tweddell at JSC, and I was able to test these cases against xlc++ version 13.1.5. The Bastian has forwarded the reports (updated for 13.1.5) on, and we'll see how things go from here. |
Point estimate: 4
Feature: #65
Some unit tests are failing when compiled with xlC++ 13 on POWER8, and there appear to be other compiler errors exercised by the code:
{}
as default argument to astd::vector
parameter was inducing an ICE.test_uninitalized
unit test exhibits a failure where anapply
method invocation is being ordered before the preceding copy construction is completed.Tasks:
The issue title says 'bug', but it's not clear if it's our bug or their bug.
The text was updated successfully, but these errors were encountered: