annotate gcc/testsuite/gcc.dg/plugin/self-assign-test-1.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Test the self-assignemnt detection plugin. */
kono
parents:
diff changeset
2 /* { dg-do compile } */
kono
parents:
diff changeset
3 /* { dg-options "-O" } */
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 struct Bar {
kono
parents:
diff changeset
6 int b_;
kono
parents:
diff changeset
7 int c_;
kono
parents:
diff changeset
8 };
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 int g;
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 int main()
kono
parents:
diff changeset
13 {
kono
parents:
diff changeset
14 struct Bar *bar;
kono
parents:
diff changeset
15 int x = x; /* { dg-warning "assigned to itself" } */
kono
parents:
diff changeset
16 static int y;
kono
parents:
diff changeset
17 struct Bar b_array[5];
kono
parents:
diff changeset
18
kono
parents:
diff changeset
19 b_array[x+g].b_ = b_array[x+g].b_; /* { dg-warning "self-assignment detected" "" { xfail *-*-* } } */
kono
parents:
diff changeset
20 g = g; /* { dg-warning "assigned to itself" } */
kono
parents:
diff changeset
21 y = y; /* { dg-warning "assigned to itself" } */
kono
parents:
diff changeset
22 bar->b_ = bar->b_; /* { dg-warning "assigned to itself" } */
kono
parents:
diff changeset
23 }