aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-4.c
blob: a96f42ca71e89c6c3556264d08457c43328868f4 (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
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-ccp" } */

extern void link_error (void);

/* some array tests -- more to come */


void test14 (int *intarr)
{
  intarr[0] = 0;
  if (intarr[0] != 0)
    link_error ();
}


void test15 (int *intarr)
{
  intarr[0] = 0;
  intarr[1] = 1;
  if (intarr[0] != 0)
    link_error ();
  if (intarr[1] != 1)
    link_error ();
}


void test16 (int *intarr, short *shortarr)
{
  intarr[0] = 1;
  shortarr[0] = 1;
  intarr[0] += 1;
  shortarr[0] += 1;

  if (intarr[0] != 2)
    link_error ();

  if (shortarr[0] != 2)
    link_error ();
}


/* There should be not link_error calls, if there is any the
   optimization has failed */
/* { dg-final { scan-tree-dump-times "link_error" 0 "ccp"} } */