Skip to content

[beta] librand unreachable pattern on armv7-unknown-linux-gnueabihf #37630

Closed
@cuviper

Description

@cuviper

I just tried builds of 1.13.0-beta.3 on Fedora 24 and Rawhide (with LLVM 3.8 and 3.9 respectively), and both builds failed only on armv7hl, in the exact same place:

CFG_LLVM_LINKAGE_FILE=/builddir/build/BUILD/rustc-beta/armv7-unknown-linux-gnueabihf/rt/llvmdeps.rs LD_LIBRARY_PATH=/builddir/build/BUILD/rustc-beta/armv7-unknown-linux-gnueabihf/stage2/lib:/usr/lib:$LD_LIBRARY_PATH   armv7-unknown-linux-gnueabihf/stage2/bin/rustc --cfg stage2 -Clink-args=-Wl,-z,relro,-z,now -O --cfg rtopt -g  --target=armv7-unknown-linux-gnueabihf  -C prefer-dynamic -L "armv7-unknown-linux-gnueabihf/rt" -L native="/usr/lib"     --out-dir armv7-unknown-linux-gnueabihf/stage2/lib/rustlib/armv7-unknown-linux-gnueabihf/lib -C extra-filename=-f02899e6 -C metadata=f02899e6 src/librand/lib.rs
error[E0001]: unreachable pattern
  --> src/librand/distributions/gamma.rs:93:13
   |
93 |             0.0...1.0 => Small(GammaSmallShape::new_raw(shape, scale)),
   |             ^^^^^^^^^ this is an unreachable pattern

That full function is:

impl Gamma {
    /// Construct an object representing the `Gamma(shape, scale)`
    /// distribution.
    ///
    /// Panics if `shape <= 0` or `scale <= 0`.
    pub fn new(shape: f64, scale: f64) -> Gamma {
        assert!(shape > 0.0, "Gamma::new called with shape <= 0");
        assert!(scale > 0.0, "Gamma::new called with scale <= 0");

        let repr = match shape {
            1.0 => One(Exp::new(1.0 / scale)),
            0.0...1.0 => Small(GammaSmallShape::new_raw(shape, scale)),
            _ => Large(GammaLargeShape::new_raw(shape, scale)),
        };
        Gamma { repr: repr }
    }
}

This particular code hasn't changed in over a year, and my i686, x86_64, and aarch64 builds were fine with it. Only armv7hl has the error, and note even then it wasn't until --cfg stage2.

I had no problem with armv7hl on prior releases, so this appears to be a beta regression. I do have one patch applied from #36933 to disable NEON, but I also had that on 1.12.1 and it went fine. I'm baffled what else could be specific to armv7hl to cause this...

Metadata

Metadata

Assignees

No one assigned

    Labels

    O-ArmTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 stateregression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions