diff --git a/dynare++/parser/cc/tree.hh b/dynare++/parser/cc/tree.hh index a125f8be8..88474b369 100644 --- a/dynare++/parser/cc/tree.hh +++ b/dynare++/parser/cc/tree.hh @@ -1,6 +1,6 @@ /* * Copyright © 2005-2011 Ondra Kamenik - * Copyright © 2019 Dynare Team + * Copyright © 2019-2022 Dynare Team * * This file is part of Dynare. * @@ -85,8 +85,8 @@ namespace ogp operator<(const Operation &op) const { return (code < op.code - || code == op.code - && (op1 < op.op1 || op1 == op.op1 && op2 < op.op2)); + || (code == op.code + && (op1 < op.op1 || (op1 == op.op1 && op2 < op.op2)))); } /** Returns a number of operands. */ int @@ -98,7 +98,7 @@ namespace ogp size_t hashval() const { - return op2+1 + (op1+1)^15 + static_cast(code)^30; + return (op2+1 + op1+1)^(15 + static_cast(code))^30; } code_t diff --git a/dynare++/sylv/cc/Vector.cc b/dynare++/sylv/cc/Vector.cc index 33db2f9f9..c84453d71 100644 --- a/dynare++/sylv/cc/Vector.cc +++ b/dynare++/sylv/cc/Vector.cc @@ -52,8 +52,8 @@ Vector::operator=(const Vector &v) throw SYLV_MES_EXCEPTION("Attempt to assign vectors with different lengths."); if (s == v.s - && (data <= v.data && v.data < data+len*s - || v.data <= data && data < v.data+v.len*v.s) + && ((data <= v.data && v.data < data+len*s) + || (v.data <= data && data < v.data+v.len*v.s)) && (data-v.data) % s == 0) throw SYLV_MES_EXCEPTION("Attempt to assign overlapping vectors."); @@ -67,8 +67,8 @@ Vector::operator=(const ConstVector &v) if (v.len != len) throw SYLV_MES_EXCEPTION("Attempt to assign vectors with different lengths."); if (s == v.s - && (data <= v.data && v.data < data+len*s - || v.data <= data && data < v.data+v.len*v.s) + && ((data <= v.data && v.data < data+len*s) + || (v.data <= data && data < v.data+v.len*v.s)) && (data-v.data) % s == 0) throw SYLV_MES_EXCEPTION("Attempt to assign overlapping vectors."); diff --git a/dynare++/sylv/testing/tests.cc b/dynare++/sylv/testing/tests.cc index f283ee4cb..b2e3628ba 100644 --- a/dynare++/sylv/testing/tests.cc +++ b/dynare++/sylv/testing/tests.cc @@ -186,8 +186,8 @@ TestRunnable::level_kron(bool trans, const std::string &mname, const std::string MMMatrixIn mmc(cname); int length = power(m, depth)*n; - if (level > 0 && mmt.row() != m - || level == 0 && mmt.row() != n + if ((level > 0 && mmt.row() != m) + || (level == 0 && mmt.row() != n) || mmv.row() != length || mmc.row() != length) {