Code Monkey home page Code Monkey logo

jh-rs's Introduction

jh-rs

Reimplementation of jh-ffi in pure rust.

jh-rs's People

Contributors

daana32 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

jh-rs's Issues

Undefined behavior: creation of unaligned reference

I've been experimenting with a version of Miri that can execute foreign functions. It interprets the LLVM bytecode that is produced during a crate's build process. We're hoping our results can assist with the Krabcake project.

I ran your test cases in this tool, and it found an instance of undefined behavior related to transmute in the test tests::large.

error: Undefined Behavior: constructing invalid value: encountered an unaligned reference (required 8 byte alignment but found 1)
   --> src/e8.rs:93:43
    |
93  |             let bitslice_ref: &[u64; 4] = std::mem::transmute(&E8_BITSLICE_ROUNDCONSTANT[roundnumber+0]);
    |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 8 byte alignment but found 1)
    |

Though the lengths of each slice within E8_BITSLICE_ROUNDCONSTANT seem to be compatible for this transmutation, it's still considered undefined behavior, since the underlying reference must also be aligned to the size of the type. I think slice::align_to might be what you're looking for here.

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.