From fdcbd6369ca5312a0630a4f748cb9a035041b7ee Mon Sep 17 00:00:00 2001 From: Sebastian Junges Date: Wed, 2 May 2018 20:52:16 +0200 Subject: [PATCH] simple sanity check for bounded integers in jani --- src/storm/parser/JaniParser.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/storm/parser/JaniParser.cpp b/src/storm/parser/JaniParser.cpp index 10f98ff35..725ab0a9d 100644 --- a/src/storm/parser/JaniParser.cpp +++ b/src/storm/parser/JaniParser.cpp @@ -706,6 +706,9 @@ namespace storm { } STORM_LOG_THROW(lowerboundExpr.hasIntegerType(), storm::exceptions::InvalidJaniException, "Lower bound for bounded integer variable " << name << "(scope: " << scopeDescription << ") must be integer-typed"); STORM_LOG_THROW(upperboundExpr.hasIntegerType(), storm::exceptions::InvalidJaniException, "Upper bound for bounded integer variable " << name << "(scope: " << scopeDescription << ") must be integer-typed"); + if(!lowerboundExpr.containsVariables() && !upperboundExpr.containsVariables()) { + STORM_LOG_THROW(lowerboundExpr.evaluateAsInt() <= upperboundExpr.evaluateAsInt(), storm::exceptions::InvalidJaniException, "Lower bound must not be larger than upper bound for bounded integer variable " << name << "(scope: " << scopeDescription << ")"); + } return storm::jani::makeBoundedIntegerVariable(name, expressionManager->declareIntegerVariable(exprManagerName), initVal, transientVar, lowerboundExpr, upperboundExpr); } else { STORM_LOG_THROW(false, storm::exceptions::InvalidJaniException, "Unsupported base " << basictype << " for bounded variable " << name << "(scope: " << scopeDescription << ") ");