Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/pr89317.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O -fdump-tree-ccp1" } */
3
4 struct b { int data[16]; };
5
6 int foo (struct b *x)
7 {
8 int *a = x->data;
9 int *b = ((int*)x) + 4;
10 return b - a;
11 }
12
13 int bar (struct b *x)
14 {
15 int *a = x->data;
16 int *b = ((int*)x) + 4;
17 if (a != b)
18 return 1;
19 return 0;
20 }
21
22 int baz (struct b *x)
23 {
24 int *a = x->data;
25 int *b = ((int*)x) + 4;
26 return (a != b);
27 }
28
29 /* { dg-final { scan-tree-dump "return 4;" "ccp1" } } */
30 /* { dg-final { scan-tree-dump-times "return 1;" 2 "ccp1" } } */