Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.dg / pr94234-3.c
blob9bb9b46bd96b6331169ff15436bdfb9695092f53
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-forwprop1" } */
4 typedef __SIZE_TYPE__ size_t;
5 typedef __PTRDIFF_TYPE__ ptrdiff_t;
7 ptrdiff_t foo1 (char *a, size_t n)
9 char *b1 = a + 8 * n;
10 char *b2 = a + 8 * (n - 1);
12 return b1 - b2;
15 int use_ptr (char *a, char *b);
17 ptrdiff_t foo2 (char *a, size_t n)
19 char *b1 = a + 8 * (n - 1);
20 char *b2 = a + 8 * n;
22 use_ptr (b1, b2);
24 return b1 - b2;
27 int use_int (int i);
29 unsigned goo (unsigned m_param, unsigned n_param)
31 unsigned b1 = m_param * (n_param + 2);
32 unsigned b2 = m_param * (n_param + 1);
33 int r = (int)(b1) - (int)(b2);
35 use_int (r);
37 return r;
40 /* { dg-final { scan-tree-dump-times "return 8;" 1 "forwprop1" } } */
41 /* { dg-final { scan-tree-dump-times "return -8;" 1 "forwprop1" } } */
42 /* { dg-final { scan-tree-dump-times "return m_param" 1 "forwprop1" } } */