From a66c305609a14380015bfb79bc03e2087a0cdc5c Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Tue, 5 Jul 2022 11:10:43 +0200 Subject: [PATCH] gen: work around a warning on red hat When n is an int, doing "new formula[n];" gives us "warning: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807" on Red Hat. * spot/gen/formulas.cc (pps_arbiter): Pass n as unsigned. Also fix some determinism in the strict variant. --- spot/gen/formulas.cc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/spot/gen/formulas.cc b/spot/gen/formulas.cc index a94512970..3f63b07e7 100644 --- a/spot/gen/formulas.cc +++ b/spot/gen/formulas.cc @@ -1,5 +1,5 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2012-2019 Laboratoire de Recherche et Developpement +// Copyright (C) 2012-2019, 2022 Laboratoire de Recherche et Developpement // de l'EPITA (LRDE). // // This file is part of Spot, a model checking library. @@ -1198,13 +1198,13 @@ namespace spot } static formula - pps_arbiter(std::string r_, std::string g_, int n, bool strict_) + pps_arbiter(std::string r_, std::string g_, unsigned n, bool strict_) { formula* r = new formula[n]; formula* g = new formula[n]; std::vector res; - for (int i = 0; i < n; ++i) + for (unsigned i = 0; i < n; ++i) { r[i] = formula::ap(r_ + std::to_string(i + 1)); g[i] = formula::ap(g_ + std::to_string(i + 1)); @@ -1218,17 +1218,17 @@ namespace spot formula phi_s; { std::vector res; - for (int i = 0; i < n; ++i) + for (unsigned i = 0; i < n; ++i) res.push_back(formula::Not(r[i])); theta_e = formula::And(res); res.clear(); - for (int i = 0; i < n; ++i) + for (unsigned i = 0; i < n; ++i) res.push_back(formula::Not(g[i])); theta_s = formula::And(res); res.clear(); - for (int i = 0; i < n; ++i) + for (unsigned i = 0; i < n; ++i) { formula left = formula::Xor(r[i], g[i]); formula right = formula::Equiv(r[i], formula::X(r[i])); @@ -1237,9 +1237,9 @@ namespace spot psi_e = formula::And(res); res.clear(); - for (int i = 0; i < n; ++i) + for (unsigned i = 0; i < n; ++i) { - for (int j = 0; j < i; ++j) + for (unsigned j = 0; j < i; ++j) res.push_back(formula::Not(formula::And({g[i], g[j]}))); formula left = formula::Equiv(r[i], g[i]); formula right = formula::Equiv(g[i], formula::X(g[i])); @@ -1248,7 +1248,7 @@ namespace spot psi_s = formula::And(res); res.clear(); - for (int i = 0; i < n; ++i) + for (unsigned i = 0; i < n; ++i) { formula f = formula::Not(formula::And({r[i], g[i]})); res.push_back(formula::G(formula::F(f))); @@ -1256,7 +1256,7 @@ namespace spot phi_e = formula::And(res); res.clear(); - for (int i = 0; i < n; ++i) + for (unsigned i = 0; i < n; ++i) { res.push_back(formula::G(formula::F(formula::Equiv(r[i], g[i])))); } @@ -1267,9 +1267,9 @@ namespace spot if (!strict_) { + formula left = formula::And({formula::G(psi_e), phi_e}); formula imp = - formula::Implies(formula::And({formula::G(psi_e), phi_e}), - formula::And({formula::G(psi_s), phi_s})); + formula::Implies(left, formula::And({formula::G(psi_s), phi_s})); return formula::Implies(theta_e, formula::And({theta_s, imp})); } else