bitset_copy from an lbitset did not check whether the destination has the same type. Apply the same strategy as elsewhere.
Without this commit, the following one fails. * lib/bitset/list.c (lbitset_copy): Rename as... (lbitset_copy_): this. (lbitset_copy): New. Dispatch to heterogeneous/homogeneous copy. --- ChangeLog | 6 ++++++ lib/bitset/list.c | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3e3e78ed3..ff21b6631 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2020-11-15 Akim Demaille <a...@lrde.epita.fr> + bitset: fix the copy from lbitset to other types + * lib/bitset/list.c (lbitset_copy): Rename as... + (lbitset_copy_): this. + (lbitset_copy): New. + Dispatch to heterogeneous/homogeneous copy. + bitset: making debug traces more useful * lib/bitset.c (bitset_print): Print the bitset type in verbose node. diff --git a/lib/bitset/list.c b/lib/bitset/list.c index c1f3d9b15..dc00fdc29 100644 --- a/lib/bitset/list.c +++ b/lib/bitset/list.c @@ -428,7 +428,7 @@ lbitset_equal_p (bitset dst, bitset src) /* Copy bits from bitset SRC to bitset DST. */ static inline void -lbitset_copy (bitset dst, bitset src) +lbitset_copy_ (bitset dst, bitset src) { if (src == dst) return; @@ -463,6 +463,15 @@ lbitset_copy (bitset dst, bitset src) } +static void +lbitset_copy (bitset dst, bitset src) +{ + if (BITSET_COMPATIBLE_ (dst, src)) + lbitset_copy_ (dst, src); + else + bitset_copy_ (dst, src); +} + /* Copy bits from bitset SRC to bitset DST. Return true if bitsets different. */ static inline bool -- 2.29.2