Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_mul_add failt in debug mode for arm-unknown-linux-gnueabi #46950

Open
malbarbo opened this issue Dec 22, 2017 · 2 comments
Open

test_mul_add failt in debug mode for arm-unknown-linux-gnueabi #46950

malbarbo opened this issue Dec 22, 2017 · 2 comments
Labels
C-bug Category: This is a bug. O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@malbarbo
Copy link
Contributor

This following test extract from libstd:

#[cfg(test)]
mod tests {
    macro_rules! assert_approx_eq {
        ($a:expr, $b:expr) => ({
            let (a, b) = (&$a, &$b);
            assert!((*a - *b).abs() < 1.0e-6,
                    "{} is not approximately equal to {}", *a, *b);
        })
    }

    #[test]
    fn f64_test_mul_add() {
        assert_approx_eq!((-12.3f64).mul_add(-4.5, -6.7), 48.65);
        assert_approx_eq!(0.0f64.mul_add(8.9, 1.2), 1.2);
    }

    #[test]
    fn f32_test_mul_add() {
        assert_approx_eq!((-12.3f32).mul_add(-4.5, -6.7), 48.65);
        assert_approx_eq!(0.0f32.mul_add(8.9, 1.2), 1.2);
    }
}

fails to run in raspbarry pi 3 and in qemu when compiled in debug mode for the target arm-unknown-linux-gnueabi. It works if compiled in release mode. rustc 1.24.0-nightly (250b49205 2017-12-21) was used.

To test using cross, create a project execute cross test --target arm-unknown-linux-gnueabi. cross execute the test using qemu-arm, but I think it is not a problem with qemu because the test also fails running in a raspbarry pi 3. Also the test works if compiled in release mode.

qemu error:

---- tests::f32_test_mul_add stdout ----
        thread 'tests::f32_test_mul_add' panicked at '38.4 is not approximately equal to 1.2', src/lib.rs:20:8

---- tests::f64_test_mul_add stdout ----
        thread 'tests::f64_test_mul_add' panicked at '38.4 is not approximately equal to 1.2', src/lib.rs:14:8

raspberry pi error:

---- tests::f32_test_mul_add stdout ----
        thread 'tests::f32_test_mul_add' panicked at '-12.3 is not approximately equal to 48.65', src/lib.rs:19:8

---- tests::f64_test_mul_add stdout ----
        thread 'tests::f64_test_mul_add' panicked at '0 is not approximately equal to 48.65', src/lib.rs:13:8
@pietroalbini pietroalbini added O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Jan 30, 2018
@Enselic
Copy link
Member

Enselic commented Sep 27, 2023

Triage: Can this still be reproduced? Wanted to check since 6 years have passed and circumstances might have changed.

@vklachkov
Copy link

@Enselic Yes, the problem is still exists. And sometimes it is reproduced in the release builds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants