1 /* Excess precision tests. Test C11 semantics for conversions from
2 integers to floating point: no excess precision for either explicit
3 conversions, but excess precision for implicit conversions. */
4 /* { dg-do run } */
5 /* { dg-options "-std=c11 -mfpmath=387 -fexcess-precision=standard" } */
6
7 extern void abort (void);
8 extern void exit (int);
9
10 int
main(void)11 main (void)
12 {
13 float f = 1.0f;
14 int i;
15
16 i = 0x10001234;
17 if ((float) i != 0x10001240)
18 abort ();
19
20 i = 0x10001234;
21 i += f;
22 if (i != 0x10001235)
23 abort ();
24
25 i = 0x10001234;
26 i += 1.0f;
27 if (i != 0x10001235)
28 abort ();
29
30 i = 0x10001234;
31 i = i + f;
32 if (i != 0x10001235)
33 abort ();
34
35 i = 0x10001234;
36 i = i + 1.0f;
37 if (i != 0x10001235)
38 abort ();
39
40 i = 0x10001235;
41 i = (1 ? i : 1.0f);
42 if (i != 0x10001235)
43 abort ();
44
45 i = 0x10001235;
46 i = (1 ? i : f);
47 if (i != 0x10001235)
48 abort ();
49
50 i = 0x10001235;
51 i = (0 ? 1.0f :i);
52 if (i != 0x10001235)
53 abort ();
54
55 i = 0x10001235;
56 i = (0 ? f : i);
57 if (i != 0x10001235)
58 abort ();
59
60 exit (0);
61 }
62