aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/excess-precision-7.c
blob: 0cdd932ce7f07858cf20fd922d55d464bb4fb061 (plain)
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
/* Excess precision tests.  Test C99 semantics for conversions from
   integers to floating point: no excess precision for either explicit
   or implicit conversions.  */
/* { dg-do run } */
/* { dg-options "-std=c99 -mfpmath=387 -fexcess-precision=standard" } */

extern void abort (void);
extern void exit (int);

int
main (void)
{
  float f = 1.0f;
  int i;

  i = 0x10001234;
  if ((float) i != 0x10001240)
    abort ();

  i = 0x10001234;
  i += f;
  if (i != 0x10001241)
    abort ();

  i = 0x10001234;
  i += 1.0f;
  if (i != 0x10001241)
    abort ();

  i = 0x10001234;
  i = i + f;
  if (i != 0x10001241)
    abort ();

  i = 0x10001234;
  i = i + 1.0f;
  if (i != 0x10001241)
    abort ();

  exit (0);
}