OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [opt/] [nrv13.C] - Blame information for rev 316

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 301 jeremybenn
// PR tree-optimization/32353
2
// { dg-do run }
3
// { dg-options "-O2" }
4
 
5
extern "C" void abort ();
6
 
7
struct A
8
{
9
  int f;
10
  A (int x) : f (x) {}
11
};
12
 
13
A
14
foo (const A &x, const A &y)
15
{
16
  A r (0);
17
  r = x.f == -111 ? y : (y.f == -111 || x.f > y.f) ? x : y;
18
  A s (0);
19
  r = r.f == -111 ? s : (r.f > s.f) ? r : s;
20
  return r;
21
}
22
 
23
int
24
main ()
25
{
26
  if (foo (A (0), A (1)).f != 1)
27
    abort ();
28
  if (foo (A (1), A (9)).f != 9)
29
    abort ();
30
  if (foo (A (9), A (1)).f != 9)
31
    abort ();
32
  if (foo (A (-4), A (-5)).f != 0)
33
    abort ();
34
  if (foo (A (-111), A (-111)).f != 0)
35
    abort ();
36
  if (foo (A (2), A (-111)).f != 2)
37
    abort ();
38
  if (foo (A (-111), A (6)).f != 6)
39
    abort ();
40
  if (foo (A (-111), A (-4)).f != 0)
41
    abort ();
42
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.