Skip to content

SMT count_trailing_zeros bug? #1562

@nwf

Description

@nwf

With a fresh build of a4a3ab6 (admittedly, on Debian 13.1 on PowerPC Linux) and cvc5 1.1.2 (specifically, Debian's 1.1.2-2+b3), this program

default Order dec
$include <vector_dec.sail>

$counterexample
function test(T : bits(3)) -> bool = count_trailing_zeros(T) >= 0

run with sail --smt --smt-auto dies a horrible death:

Checking counterexample: test.smt2
test.smt2:2.2: No set-logic command was given before this point.
test.smt2:2.2: cvc5 will make all theories available.
test.smt2:2.2: Consider setting a stricter logic for (likely) better performance.
test.smt2:2.2: To suppress this warning in the future use (set-logic ALL).
Solver found counterexample: ok
  zz53zE0 -> 0b001
Failed to replay counterexample: error
  Function returned true
Error:
./properties/test.sail:5.9-13:
5 |function test(T : bits(3)) -> bool = count_trailing_zeros(T) >= 0
  |         ^--^
  | Property check failure for test.

I suspect that this means there's a bug in the count_trailing_zeros intrinsic implementation in the SMT backend, but I won't pretend to be certain.

FWIW, varying the length of the vector T : bits(N) a bit...

N result
1 SMT unsat (no claimed counter example)
2 SMT unsat
3 as above
4 SMT unsat
5 as above; claimed counterexample is 0b00100
6 as above; claimed counterexample is 0b000010
7 as above; claimed counterexample is 0b0000001
8 SMT unsat

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions