]> git.lizzy.rs Git - rust.git/blob - src/test/mir-opt/const_prop/bad_op_mod_by_zero/rustc.main.ConstProp.diff
Show the values and computation that would overflow a const evaluation or propagation
[rust.git] / src / test / mir-opt / const_prop / bad_op_mod_by_zero / rustc.main.ConstProp.diff
1 - // MIR for `main` before ConstProp
2 + // MIR for `main` after ConstProp
3   
4   fn main() -> () {
5       let mut _0: ();                      // return place in scope 0 at $DIR/bad_op_mod_by_zero.rs:3:11: 3:11
6       let _1: i32;                         // in scope 0 at $DIR/bad_op_mod_by_zero.rs:4:9: 4:10
7       let mut _3: i32;                     // in scope 0 at $DIR/bad_op_mod_by_zero.rs:5:18: 5:19
8       let mut _4: bool;                    // in scope 0 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
9       let mut _5: bool;                    // in scope 0 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
10       let mut _6: bool;                    // in scope 0 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
11       let mut _7: bool;                    // in scope 0 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
12       scope 1 {
13           debug y => _1;                   // in scope 1 at $DIR/bad_op_mod_by_zero.rs:4:9: 4:10
14           let _2: i32;                     // in scope 1 at $DIR/bad_op_mod_by_zero.rs:5:9: 5:11
15           scope 2 {
16               debug _z => _2;              // in scope 2 at $DIR/bad_op_mod_by_zero.rs:5:9: 5:11
17           }
18       }
19   
20       bb0: {
21           StorageLive(_1);                 // scope 0 at $DIR/bad_op_mod_by_zero.rs:4:9: 4:10
22           _1 = const 0_i32;                // scope 0 at $DIR/bad_op_mod_by_zero.rs:4:13: 4:14
23                                            // ty::Const
24                                            // + ty: i32
25                                            // + val: Value(Scalar(0x00000000))
26                                            // mir::Constant
27                                            // + span: $DIR/bad_op_mod_by_zero.rs:4:13: 4:14
28                                            // + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
29           StorageLive(_2);                 // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:9: 5:11
30           StorageLive(_3);                 // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:18: 5:19
31 -         _3 = _1;                         // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:18: 5:19
32 -         _4 = Eq(_3, const 0_i32);        // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
33 +         _3 = const 0_i32;                // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:18: 5:19
34                                            // ty::Const
35                                            // + ty: i32
36                                            // + val: Value(Scalar(0x00000000))
37                                            // mir::Constant
38 -                                          // + span: $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
39 +                                          // + span: $DIR/bad_op_mod_by_zero.rs:5:18: 5:19
40                                            // + literal: Const { ty: i32, val: Value(Scalar(0x00000000)) }
41 +         _4 = const true;                 // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
42 +                                          // ty::Const
43 +                                          // + ty: bool
44 +                                          // + val: Value(Scalar(0x01))
45 +                                          // mir::Constant
46 +                                          // + span: $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
47 +                                          // + literal: Const { ty: bool, val: Value(Scalar(0x01)) }
48           assert(!move _4, "attempt to calculate the remainder of {} with a divisor of zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
49                                            // ty::Const
50                                            // + ty: i32
51                                            // + val: Value(Scalar(0x00000001))
52                                            // mir::Constant
53                                            // + span: $DIR/bad_op_mod_by_zero.rs:5:14: 5:15
54                                            // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
55       }
56   
57       bb1: {
58 -         _5 = Eq(_3, const -1_i32);       // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
59 +         _5 = const false;                // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
60                                            // ty::Const
61 -                                          // + ty: i32
62 -                                          // + val: Value(Scalar(0xffffffff))
63 +                                          // + ty: bool
64 +                                          // + val: Value(Scalar(0x00))
65                                            // mir::Constant
66                                            // + span: $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
67 -                                          // + literal: Const { ty: i32, val: Value(Scalar(0xffffffff)) }
68 -         _6 = Eq(const 1_i32, const i32::MIN); // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
69 +                                          // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
70 +         _6 = const false;                // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
71                                            // ty::Const
72 -                                          // + ty: i32
73 -                                          // + val: Value(Scalar(0x00000001))
74 +                                          // + ty: bool
75 +                                          // + val: Value(Scalar(0x00))
76                                            // mir::Constant
77 -                                          // + span: $DIR/bad_op_mod_by_zero.rs:5:14: 5:15
78 -                                          // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
79 +                                          // + span: $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
80 +                                          // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
81 +         _7 = const false;                // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
82                                            // ty::Const
83 -                                          // + ty: i32
84 -                                          // + val: Value(Scalar(0x80000000))
85 +                                          // + ty: bool
86 +                                          // + val: Value(Scalar(0x00))
87                                            // mir::Constant
88                                            // + span: $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
89 -                                          // + literal: Const { ty: i32, val: Value(Scalar(0x80000000)) }
90 -         _7 = BitAnd(move _5, move _6);   // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
91 -         assert(!move _7, "attempt to compute the remainder of `{} % {}` which would overflow", const 1_i32, _3) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
92 +                                          // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
93 +         assert(!const false, "attempt to compute the remainder of `{} % {}` which would overflow", const 1_i32, _3) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
94 +                                          // ty::Const
95 +                                          // + ty: bool
96 +                                          // + val: Value(Scalar(0x00))
97 +                                          // mir::Constant
98 +                                          // + span: $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
99 +                                          // + literal: Const { ty: bool, val: Value(Scalar(0x00)) }
100                                            // ty::Const
101                                            // + ty: i32
102                                            // + val: Value(Scalar(0x00000001))
103                                            // mir::Constant
104                                            // + span: $DIR/bad_op_mod_by_zero.rs:5:14: 5:15
105                                            // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
106       }
107   
108       bb2: {
109           _2 = Rem(const 1_i32, move _3);  // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
110                                            // ty::Const
111                                            // + ty: i32
112                                            // + val: Value(Scalar(0x00000001))
113                                            // mir::Constant
114                                            // + span: $DIR/bad_op_mod_by_zero.rs:5:14: 5:15
115                                            // + literal: Const { ty: i32, val: Value(Scalar(0x00000001)) }
116           StorageDead(_3);                 // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:18: 5:19
117           _0 = const ();                   // scope 0 at $DIR/bad_op_mod_by_zero.rs:3:11: 6:2
118                                            // ty::Const
119                                            // + ty: ()
120                                            // + val: Value(Scalar(<ZST>))
121                                            // mir::Constant
122                                            // + span: $DIR/bad_op_mod_by_zero.rs:3:11: 6:2
123                                            // + literal: Const { ty: (), val: Value(Scalar(<ZST>)) }
124           StorageDead(_2);                 // scope 1 at $DIR/bad_op_mod_by_zero.rs:6:1: 6:2
125           StorageDead(_1);                 // scope 0 at $DIR/bad_op_mod_by_zero.rs:6:1: 6:2
126           return;                          // scope 0 at $DIR/bad_op_mod_by_zero.rs:6:2: 6:2
127       }
128   }
129