aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/pr38245-2.c
blob: 2998299375d72ec95b46a5cdf8cdb281b370f640 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/* PR rtl-optimization/38245 */
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */

extern void link_error (void);

void
f1 (unsigned int a)
{
  if (a != 28)
    {
      if (4 / a == 5)
	link_error ();
    }
}

void
f2 (unsigned int a)
{
  if (4 / a == 5)
    link_error ();
}

void
f3 (unsigned int a)
{
  if (4 / (a & 0xff) == 5)
    link_error ();
}

void
f4 (unsigned int a, unsigned int b)
{
  if ((b & 3) / ((a & 0xff) + 1) == 5)
    link_error ();
}

void
f5 (int a)
{
  if (a != 28)
    {
      if (4 / a == 5)
	link_error ();
    }
}

void
f6 (int a)
{
  if (4 / a == 5)
    link_error ();
}

void
f7 (int a)
{
  if (4 / (a & 0xff) == 5)
    link_error ();
}

void
f8 (int a, int b)
{
  if ((b & 3) / ((a & 0xff) + 1) == 5)
    link_error ();
}

void
f9 (int a, int b)
{
  if (b >= 4)
    if ((a / b) == __INT_MAX__ / 2)
      link_error ();
}

void
f10 (unsigned int a, unsigned int b)
{
  if (b >= 16)
    if ((a / b) == __INT_MAX__ / 4)
      link_error ();
}

void
f11 (int a, int b)
{
  if (b <= -32)
    if ((a / b) == -__INT_MAX__ / 16)
      link_error ();
}

void
f12 (int a, int b)
{
  if (a >= -6 && a <= 4)
    if ((a / b) == -7 || (a / b) == 7)
      link_error ();
}

void
f13 (unsigned int a, unsigned int b)
{
  if (a <= 4)
    if ((a / b) == 5)
      link_error ();
}

/* { dg-final { scan-tree-dump-not "link_error" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */