Giter Site home page Giter Site logo

Comments (13)

parched avatar parched commented on September 26, 2024 1

Ok, I've debugged it and looks like LLVM bug for unsigned multiplication with overflow. I'll make a patch.

from compiler-builtins.

japaric avatar japaric commented on September 26, 2024

Another case that results in an assertion (1750458948, 2611493155) with divdi3.

from compiler-builtins.

japaric avatar japaric commented on September 26, 2024

Testing all these intrinsics fail due to this debug assertion

  • divdi3
  • divmoddi4
  • moddi3
  • modsi3
  • udivmoddi4
  • udivmodsi4
  • umoddi3
  • umodsi3

from compiler-builtins.

parched avatar parched commented on September 26, 2024

This is probably fix by rust-lang/llvm#79

from compiler-builtins.

parched avatar parched commented on September 26, 2024

@japaric I think this should be fixed in the latest nightly now that rust-lang/rust#42410 has landed.

from compiler-builtins.

japaric avatar japaric commented on September 26, 2024

I tested with rustc 1.19.0-nightly (fe7227f6c 2017-06-16) and I'm still seeing the debug assertion. I'll try again with the next nightly release.

from compiler-builtins.

parched avatar parched commented on September 26, 2024

Ok, that commit had the fix in, so this must be caused by something else.

from compiler-builtins.

parched avatar parched commented on September 26, 2024

@japaric I'd like to debug this, how exactly did you run the test? Do I have to build all of std with Xargo for thumbv6m-linux-eabi?

from compiler-builtins.

japaric avatar japaric commented on September 26, 2024

@parched I actually ran the whole test suite with sh ci/run.sh thumbv6m-linux-eabi. But you can run a single custom test like this:

$ edit tests/custom.rs && cat $_
#![feature(compiler_builtins_lib)]
#![no_std]

extern crate compiler_builtins;
extern crate utest_cortex_m_qemu;
#[macro_use]
extern crate utest_macros;

macro_rules! panic {
    ($($tt:tt)*) => {
        upanic!($($tt)*);
    };
}

use compiler_builtins::int::sdiv::__divmoddi4;

#[test]
fn divmoddi4() {
    let (a, b) = (4165187992, 3876330169);
    let mut rem = 0;
    let c = __divmoddi4(a, b, &mut rem);
}
$ xargo test --test custom --target thumbv6m-linux-eabi --features 'mem gen-tests' --no-run
$ qemu-arm target/thumbv6m-linux-eabi/debug/custom-6bc70d2d2f80ab1e
running 1 tests
test divmoddi4 ...
panicked at 'attempt to multiply with overflow', src/int/udiv.rs:95
qemu: uncaught target signal 4 (Illegal instruction) - core dumped
[1]    27726 illegal hardware instruction (core dumped)  qemu-arm target/thumbv6m-linux-eabi/debug/custom-6bc70d2d2f80ab1e

from compiler-builtins.

japaric avatar japaric commented on September 26, 2024

Thanks for investigating and working on this @parched ❤️

from compiler-builtins.

parched avatar parched commented on September 26, 2024

No problem, the fix has been accepted upstream. Once rust-lang/llvm#85 is merged and rust is updated hopefully this will be fixed.

from compiler-builtins.

parched avatar parched commented on September 26, 2024

@japaric Do some tests need to be re-enabled now?

from compiler-builtins.

japaric avatar japaric commented on September 26, 2024

@parched Yes. I'll send a PR later today. (I suspect a nightly with the fix may not be out yet.)

from compiler-builtins.

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.