diff --git a/src/misc/bitvect.hh b/src/misc/bitvect.hh index 474e96854..b641326d9 100644 --- a/src/misc/bitvect.hh +++ b/src/misc/bitvect.hh @@ -131,7 +131,7 @@ namespace spot size_t used_blocks() const { const size_t bpb = 8 * sizeof(block_t); - return (size_ - 1) / bpb + 1; + return (size_ + bpb - 1) / bpb; } /// Append one bit. diff --git a/src/tgbatest/dstar.test b/src/tgbatest/dstar.test index 826837ce0..499252d01 100755 --- a/src/tgbatest/dstar.test +++ b/src/tgbatest/dstar.test @@ -1,6 +1,6 @@ #!/bin/sh # -*- coding: utf-8 -*- -# Copyright (C) 2013 Laboratoire de Recherche et +# Copyright (C) 2013, 2014 Laboratoire de Recherche et # Développement de l'Epita (LRDE). # # This file is part of Spot, a model checking library. @@ -237,3 +237,33 @@ EOF diff expected stdout test "`../../bin/dstar2tgba -D dra.dstar --stats '%s %t %p %d'`" = "3 12 1 1" + +# This has caused a crash at some point when dealing with 0-sized +# bitsets to represent acceptance sets. +cat >aut.dsa <expected< 1 + 1 [label="0"] + 1 -> 1 [label="1\n"] + 1 -> 2 [label="1\n"] + 2 [label="1"] + 2 -> 2 [label="1\n"] +} +EOF + +diff expected stdout