aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/20030414-2.c
blob: f4eb8bf36ec2b3d2bfdd6d824f284beb9c897d55 (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
/* Copyright (C) 2003 Free Software Foundation.

   Check that constant folding (c1 - x) op c2 into x swap(op) c1-c2
   doesn't break anything.

   Written by Roger Sayle, 27th March 2003.  */

/* { dg-do run } */
/* { dg-options "-O2 -ffast-math" } */

extern void abort (void);

int foo(double x)
{
  return (10.0 - x) > 3.0;
}

int bar (double x)
{
  return (10.0 - x) == 5.0;
}

int main()
{
  if (foo (8.0))
    abort ();

  if (! foo (6.0))
    abort ();

  if (bar (1.0))
    abort ();

  if (! bar (5.0))
    abort ();
  return 0;
}