From af8d9b0ad8a6977f9f538556719a75ce4c3ae8ef Mon Sep 17 00:00:00 2001 From: dehnert Date: Fri, 23 Sep 2016 10:54:47 +0200 Subject: [PATCH 1/2] added underflow check in PRISM next-state generator Former-commit-id: dc7f0ea3c7f88936c0d02bb44379b12e5c7f667e --- src/generator/PrismNextStateGenerator.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/generator/PrismNextStateGenerator.cpp b/src/generator/PrismNextStateGenerator.cpp index 7eb2291c5..ab1311076 100644 --- a/src/generator/PrismNextStateGenerator.cpp +++ b/src/generator/PrismNextStateGenerator.cpp @@ -305,6 +305,7 @@ namespace storm { } int_fast64_t assignedValue = this->evaluator.asInt(assignmentIt->getExpression()); STORM_LOG_THROW(assignedValue <= integerIt->upperBound, storm::exceptions::WrongFormatException, "The update " << update << " leads to an out-of-bounds value (" << assignedValue << ") for the variable '" << assignmentIt->getVariableName() << "'."); + STORM_LOG_THROW(assignedValue >= integerIt->lowerBound, storm::exceptions::WrongFormatException, "The update " << update << " leads to an out-of-bounds value (" << assignedValue << ") for the variable '" << assignmentIt->getVariableName() << "'."); newState.setFromInt(integerIt->bitOffset, integerIt->bitWidth, assignedValue - integerIt->lowerBound); STORM_LOG_ASSERT(static_cast(newState.getAsInt(integerIt->bitOffset, integerIt->bitWidth)) + integerIt->lowerBound == assignedValue, "Writing to the bit vector bucket failed (read " << newState.getAsInt(integerIt->bitOffset, integerIt->bitWidth) << " but wrote " << assignedValue << ")."); } From 8e565a2930a27f40ba19ba3982893050646129da Mon Sep 17 00:00:00 2001 From: dehnert Date: Mon, 26 Sep 2016 20:09:06 +0200 Subject: [PATCH 2/2] forcing boost to use old optional implementation to prevent bug in spirit in boost 1.61; everyone can finally update and we take out the option as soon as this is resolved on the boost side of things Former-commit-id: 92bc4796a04733e8959e84797cb459e64e437059 --- CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e749e419..645f0649d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,7 +125,12 @@ if(CMAKE_COMPILER_IS_GNUCC) # Set standard flags for GCC set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -funroll-loops") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -funroll-loops") - add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE) + + # TODO: remove forcing the old version of optional as soon as the related Spirit bug is fixed: + # https://svn.boost.org/trac/boost/ticket/12349 + # Fix thanks to: https://github.com/freeorion/freeorion/issues/777 + add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE -DBOOST_OPTIONAL_CONFIG_USE_OLD_IMPLEMENTATION_OF_OPTIONAL) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -pedantic -Wno-deprecated-declarations -Wno-unused-local-typedefs -Wno-unknown-pragmas") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -Wno-deprecated-declarations") if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) @@ -187,7 +192,10 @@ else(CLANG) set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") endif() - add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE) + # TODO: remove forcing the old version of optional as soon as the related Spirit bug is fixed: + # https://svn.boost.org/trac/boost/ticket/12349 + # Fix thanks to: https://github.com/freeorion/freeorion/issues/777 + add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE -DBOOST_OPTIONAL_CONFIG_USE_OLD_IMPLEMENTATION_OF_OPTIONAL) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -stdlib=${CLANG_STDLIB} -Wall -pedantic -Wno-newline-eof -Wno-mismatched-tags -Wno-unused-local-typedefs -ftemplate-depth=1024 -Wno-parentheses-equality") if(FORCE_COLOR)