Skip to content

Commit 1932577

Browse files
Andrzej Religabjornmu
authored andcommitted
Bug#28585914 ROUTER TEST ISSUES REPORTED FOR PB2 8.0.13 RELEASE BRANCH - SOLARIS X86
There seems to be a compiler issue that is making the binary SEGFAULT each time std::condition_variable::wait_for gets called. This can be observed on a simple example: std::condition_variable cv; std::mutex cv_m; int main() { std::unique_lock<std::mutex> lk(cv_m); cv.wait_for(lk, std::chrono::milliseconds(10), [](){return true;}); } If you compile it with: $ /opt/developerstudio12.6/bin/CC -std=c++11 -m64 -xO2 test.cc -o testapp you'll get a crash when running the binary. -xO1 doesn't crash -xO2 crashes -xO3 doesn't crash -xO4 doesn't crash -xO5 doesn't crash This patch is really only a workaround to change the optimization level to -xO1 for the router sources to avoid this issue. Reviewed-by: Tor Didriksen <[email protected]> RB: #20426
1 parent 2c04137 commit 1932577

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

router/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ IF(SOLARIS)
5555
# disable rapidjson optimisation on Solaris as it breaks
5656
# shared objects that build with -fPIC
5757
ADD_DEFINITIONS(-DRAPIDJSON_48BITPOINTER_OPTIMIZATION=0)
58+
59+
# Sun Studio 12.6 creates a bogus code when -x02 is used
60+
# that crashes whenever std::condition_variable::wait_for() is used
61+
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64"
62+
OR CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
63+
STRING_APPEND(CMAKE_CXX_FLAGS_RELWITHDEBINFO " -xO1")
64+
STRING_APPEND(CMAKE_CXX_FLAGS_RELEASE " -xO1")
65+
STRING_APPEND(CMAKE_CXX_FLAGS_MINSIZEREL " -xO1")
66+
ENDIF()
5867
ENDIF()
5968

6069
INCLUDE(${CMAKE_SOURCE_DIR}/cmake/rapidjson.cmake)

0 commit comments

Comments
 (0)