File tree 2 files changed +36
-0
lines changed
2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ // run-pass
2
+ // compile-flags: -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Copt-level=0 -Cdebuginfo=2
3
+ // ignore-tidy-linelength
4
+
5
+ // Make sure LLVM does not miscompile this.
6
+
7
+ fn make_string ( ch : char ) -> String {
8
+ let mut bytes = [ 0u8 ; 4 ] ;
9
+ ch. encode_utf8 ( & mut bytes) . into ( )
10
+ }
11
+
12
+ fn main ( ) {
13
+ let ch = '😃' ;
14
+ dbg ! ( ch) ;
15
+ let string = make_string ( ch) ;
16
+ dbg ! ( string) ;
17
+ }
Original file line number Diff line number Diff line change
1
+ // run-pass
2
+ // compile-flags: -Copt-level=0 -Cdebuginfo=2
3
+
4
+ // Make sure LLVM does not miscompile this.
5
+
6
+ fn indirect_get_slice ( ) -> & ' static [ usize ] {
7
+ & [ ]
8
+ }
9
+
10
+ #[ inline( always) ]
11
+ fn get_slice ( ) -> & ' static [ usize ] {
12
+ let ret = indirect_get_slice ( ) ;
13
+ ret
14
+ }
15
+
16
+ fn main ( ) {
17
+ let output = get_slice ( ) . len ( ) ;
18
+ assert_eq ! ( output, 0 ) ;
19
+ }
You can’t perform that action at this time.
0 commit comments