File: basic-types-globals.rs

package info (click to toggle)
rustc 1.92.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 956,280 kB
  • sloc: xml: 158,148; javascript: 23,448; sh: 19,588; python: 15,739; ansic: 13,660; cpp: 7,009; asm: 4,376; makefile: 724; lisp: 180; sql: 15
file content (106 lines) | stat: -rw-r--r-- 2,711 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
//@ revisions: lto no-lto

//@ compile-flags:-g
//@ disable-gdb-pretty-printers

//@ [lto] compile-flags:-C lto
//@ [lto] no-prefer-dynamic
//@ ignore-backends: gcc

// lldb-command:run
// lldb-command:v B
// lldb-check: ::B::[...] = false
// lldb-command:v I
// lldb-check: ::I::[...] = -1
// lldb-command:v --format=d C
// lldb-check: ::C::[...] = 97
// lldb-command:v --format=d I8
// lldb-check: ::I8::[...] = 68
// lldb-command:v I16
// lldb-check: ::I16::[...] = -16
// lldb-command:v I32
// lldb-check: ::I32::[...] = -32
// lldb-command:v I64
// lldb-check: ::I64::[...] = -64
// lldb-command:v U
// lldb-check: ::U::[...] = 1
// lldb-command:v --format=d U8
// lldb-check: ::U8::[...] = 100
// lldb-command:v U16
// lldb-check: ::U16::[...] = 16
// lldb-command:v U32
// lldb-check: ::U32::[...] = 32
// lldb-command:v U64
// lldb-check: ::U64::[...] = 64
// lldb-command:v F16
// lldb-check: ::F16::[...] = 1.5
// lldb-command:v F32
// lldb-check: ::F32::[...] = 2.5
// lldb-command:v F64
// lldb-check: ::F64::[...] = 3.5

// gdb-command:run
// gdb-command:print B
// gdb-check:$1 = false
// gdb-command:print I
// gdb-check:$2 = -1
// gdb-command:print/d C
// gdb-check:$3 = 97
// gdb-command:print I8
// gdb-check:$4 = 68
// gdb-command:print I16
// gdb-check:$5 = -16
// gdb-command:print I32
// gdb-check:$6 = -32
// gdb-command:print I64
// gdb-check:$7 = -64
// gdb-command:print U
// gdb-check:$8 = 1
// gdb-command:print U8
// gdb-check:$9 = 100
// gdb-command:print U16
// gdb-check:$10 = 16
// gdb-command:print U32
// gdb-check:$11 = 32
// gdb-command:print U64
// gdb-check:$12 = 64
// gdb-command:print F16
// gdb-check:$13 = 1.5
// gdb-command:print F32
// gdb-check:$14 = 2.5
// gdb-command:print F64
// gdb-check:$15 = 3.5
// gdb-command:continue

#![allow(unused_variables)]
#![feature(f16)]

// N.B. These are `mut` only so they don't constant fold away.
static mut B: bool = false;
static mut I: isize = -1;
static mut C: char = 'a';
static mut I8: i8 = 68;
static mut I16: i16 = -16;
static mut I32: i32 = -32;
static mut I64: i64 = -64;
static mut U: usize = 1;
static mut U8: u8 = 100;
static mut U16: u16 = 16;
static mut U32: u32 = 32;
static mut U64: u64 = 64;
static mut F16: f16 = 1.5;
static mut F32: f32 = 2.5;
static mut F64: f64 = 3.5;

fn main() {
    _zzz(); // #break

    let a = unsafe { (B, I, C, I8, I16, I32, I64, U, U8, U16, U32, U64, F32, F64) };
    // FIXME: Including f16 and f32 in the same tuple emits `__gnu_h2f_ieee`, which
    // does not exist on some targets like PowerPC.
    // See https://github.com/llvm/llvm-project/issues/97981 and
    // https://github.com/rust-lang/compiler-builtins/issues/655
    let b = unsafe { F16 };
}

fn _zzz() {()}