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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [pr38364.c] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* PR middle-end/38364 */
2
/* { dg-do run } */
3
/* { dg-options "-O2 -ftrapv" } */
4
 
5
extern void abort (void);
6
 
7
static inline short
8
f1 (short x, short y)
9
{
10
  if (x > 0)
11
    {
12
      if (y > 0)
13
        {
14
          if (x > __SHRT_MAX__ / y)
15
            return x;
16
        }
17
      else if (y < (-__SHRT_MAX__ - 1) / x)
18
        return x;
19
    }
20
  else
21
    {
22
      if (y > 0)
23
        {
24
          if (x < (-__SHRT_MAX__ - 1) / y)
25
            return x;
26
        }
27
      else if (x != 0 && y < __SHRT_MAX__ / x)
28
        return x;
29
    }
30
  return x * y;
31
}
32
 
33
static inline signed char
34
f2 (signed char x, signed char y)
35
{
36
  if (((x ^ y) & (((x ^ ((x ^ y) & (1 << (__CHAR_BIT__ - 1)))) - y) ^ y)) < 0)
37
    return x;
38
  return x - y;
39
}
40
 
41
unsigned int v;
42
 
43
int
44
f3 (int x, unsigned int y)
45
{
46
  f1 (1, 1);
47
  return 1;
48
}
49
 
50
int
51
f4 (unsigned short x)
52
{
53
  v = x;
54
  return 1;
55
}
56
 
57
int
58
f5 (int x)
59
{
60
  if (f2 (x, 1))
61
    f1 (1, f4 (1));
62
  return x;
63
}
64
 
65
int
66
f6 (unsigned int x)
67
{
68
  f4 (x < (1 != f5 (0)));
69
  return x;
70
}
71
 
72
int
73
main (void)
74
{
75
  f6 (1);
76
  if (v != 0)
77
    abort ();
78
  return 0;
79
}

powered by: WebSVN 2.1.0

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