Giter Site home page Giter Site logo

Panic while compiling `libm` about mirai HOT 3 CLOSED

Zeta611 avatar Zeta611 commented on June 9, 2024
Panic while compiling `libm`

from mirai.

Comments (3)

Zeta611 avatar Zeta611 commented on June 9, 2024

I'm not really sure the above fix is the right way---at least it fixed the above issue, which happened while analyzing sqrt(https://github.com/rust-lang/libm/blob/cb2ffdf5435d3302c97a27c8ce7de48e214de037/src/math/sqrt.rs#L151).
MIRAI tried to compute transmute(old(param_1): F64, U64) / two^32 in numeric_shr, but lf was false although it was transmuted to U64.

However, MIRAI panics shortly after making more progress while analyzing the fma function(https://github.com/rust-lang/libm/blob/cb2ffdf5435d3302c97a27c8ce7de48e214de037/src/math/fma.rs#L44).

from mirai.

Zeta611 avatar Zeta611 commented on June 9, 2024

The issue while analyzing the fma function boils down to calling bv_cast with the result of bv_overflows.

bv_cast expects ast and mask to have same sorts, as it calls Z3_mk_bvand(_, ast, mask)(https://github.com/prove-rs/z3.rs/blob/26ddf7fb90ea62509bb235286024fc7f76319591/z3-sys/src/lib.rs#L2467).
However, if ast gets returned from bv_overflows, it has Boolean sort, due to the call to Z3_mk_not (https://github.com/prove-rs/z3.rs/blob/26ddf7fb90ea62509bb235286024fc7f76319591/z3-sys/src/lib.rs#L2285).
mask has BitVector sort.

The following is what happens:

get_as_bv_z3_ast(self: "Z3Solver",expression: (overflows((local_22(11): U64) - (local_20(11): U64))) as U64,num_bits: 64)
bv_cast(self: "Z3Solver",expression: overflows((local_22(11): U64) - (local_20(11): U64)),target_type: U64,num_bits: 64)
ast "(not (bvule |local_20(11)| |local_22(11)|))" has sort "Bool"
mask "#xffffffffffffffff" has sort "(_ BitVec 64)"
Error: operator is applied to arguments of the wrong sort

Not quite sure how to fix this though.

from mirai.

Zeta611 avatar Zeta611 commented on June 9, 2024

I have created a PR that fixes these issues.

from mirai.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.