Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | /* Copyright 2019-2020 Free Software Foundation, Inc. |
8bdc1658 AB |
2 | |
3 | This file is part of GDB. | |
4 | ||
5 | This program is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 3 of the License, or | |
8 | (at your option) any later version. | |
9 | ||
10 | This program is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
17 | ||
18 | /* Unlike the other 'complex.c' test, this one uses the "standard" header | |
19 | file to pull in the complex types. The testing is around printing the | |
20 | complex numbers, and using the convenience function $_cimag and $_creal | |
21 | to extract the parts of the complex numbers. */ | |
22 | ||
23 | #include <complex.h> | |
24 | ||
25 | void | |
26 | keep_around (volatile void *ptr) | |
27 | { | |
28 | asm ("" ::: "memory"); | |
29 | } | |
30 | ||
31 | int | |
32 | main (void) | |
33 | { | |
34 | double complex z1 = 1.5 + 4.5 * I; | |
35 | float complex z2 = 2.5 - 5.5 * I; | |
36 | long double complex z3 = 3.5 + 6.5 * I; | |
37 | ||
38 | double d1 = 1.5; | |
39 | float f1 = 2.5; | |
40 | int i1 = 3; | |
41 | ||
42 | keep_around (&z1); | |
43 | keep_around (&z2); | |
44 | keep_around (&z3); | |
45 | keep_around (&d1); | |
46 | keep_around (&f1); | |
47 | keep_around (&i1); | |
48 | ||
49 | return 0; /* Break Here. */ | |
50 | } |