formula: catch min/max overflows at construction

For issue #485.

* spot/tl/formula.cc, spot/tl/formula.hh: Catch min/max overflow
when the operators are constructed.  Also disable travial
simplification rules that would create such overflow.
For instance x[*200][*2] will not become x[*400] anymore.
* python/spot/impl.i: Catch std::overflow_error.
* tests/core/equals.test, tests/python/except.py: Add test cases.
This commit is contained in:
Alexandre Duret-Lutz 2021-11-18 11:18:06 +01:00
parent 59b361babd
commit afdd38277d
5 changed files with 127 additions and 35 deletions

View file

@ -460,14 +460,18 @@ static void handle_any_exception()
{
SWIG_Error(SWIG_ValueError, e.what());
}
catch (const std::runtime_error& e)
catch (const std::overflow_error& e)
{
SWIG_Error(SWIG_RuntimeError, e.what());
SWIG_Error(SWIG_OverflowError, e.what());
}
catch (const std::out_of_range& e)
{
SWIG_Error(SWIG_IndexError, e.what());
}
catch (const std::runtime_error& e)
{
SWIG_Error(SWIG_RuntimeError, e.what());
}
}
%}