Commit 4f31a9bb authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

bitvect: fix block_count() on 0-sized bit-vectors

The bug was introduced by 52237398.

* src/misc/bitvect.hh (block_count): Here.
* src/tgbatest/dstar.test: Add a test case.
parent 91789b9b
......@@ -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.
......
#!/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 <<EOF
DSA v2 explicit
Comment: "Streett{Safra[NBA=1]}"
States: 1
Acceptance-Pairs: 0
Start: 0
AP: 0
---
State: 0
Acc-Sig:
0
EOF
run 0 ../ltl2tgba -XDD aut.dsa | tee stdout
cat >expected<<EOF
digraph G {
0 [label="", style=invis, height=0]
0 -> 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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment