rust/tests/mir-opt/building/custom/consts.statics.built.after.mir
Ulrich Weigand 6885733c41 Fix mir-opt tests for big-endian platforms
The test cases src/test/mir-opt/building/custom/consts.rs and
src/test/mir-opt/const_prop/mutable_variable_no_prop.rs are
currently failing on big-endian platforms as the binary encoding
of some constants is hard-coded in the MIR test files.  Fix this
by choosing constant values that have the same encoding on big-
and little-endian platforms.

The test case src/test/mir-opt/issues/issue_75439.rs is failing
as well, but since the purpose of the test is to validate handling
of big-endian integer encodings on a little-endian platform, it does
not make much sense to run it on big-endian platforms in the first
place - we can just ignore it there.

Fixed part of https://github.com/rust-lang/rust/issues/105383.
2023-01-12 18:05:30 +01:00

28 lines
1.3 KiB
Rust

// MIR for `statics` after built
fn statics() -> () {
let mut _0: (); // return place in scope 0 at $DIR/consts.rs:+0:14: +0:14
let mut _1: &i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
let mut _2: *mut i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
bb0: {
_1 = const {alloc1: &i32}; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
// mir::Constant
// + span: $DIR/consts.rs:27:31: 27:32
// + literal: Const { ty: &i32, val: Value(Scalar(alloc1)) }
_2 = const {alloc2: *mut i32}; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL
// mir::Constant
// + span: $DIR/consts.rs:28:38: 28:39
// + literal: Const { ty: *mut i32, val: Value(Scalar(alloc2)) }
return; // scope 0 at $DIR/consts.rs:+4:9: +4:17
}
}
alloc2 (static: T, size: 4, align: 4) {
0a 0a 0a 0a ....
}
alloc1 (static: S, size: 4, align: 4) {
05 05 05 05 ....
}