annotate gcc/testsuite/c-c++-common/Wduplicated-branches-8.c @ 19:2b5abeee2509 default tip

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16
kono
parents:
diff changeset
1 /* PR c/64279 */
kono
parents:
diff changeset
2 /* { dg-do compile } */
kono
parents:
diff changeset
3 /* { dg-options "-Wduplicated-branches" } */
kono
parents:
diff changeset
4
kono
parents:
diff changeset
5 #define A 5
kono
parents:
diff changeset
6 #define B 5
kono
parents:
diff changeset
7 #define I i
kono
parents:
diff changeset
8 extern int a[10];
kono
parents:
diff changeset
9 extern int g;
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 int
kono
parents:
diff changeset
12 f (int i)
kono
parents:
diff changeset
13 {
kono
parents:
diff changeset
14 if (i == 1) /* { dg-warning "this condition has identical branches" } */
kono
parents:
diff changeset
15 return a[5];
kono
parents:
diff changeset
16 else
kono
parents:
diff changeset
17 return a[5];
kono
parents:
diff changeset
18
kono
parents:
diff changeset
19 if (i == 2) /* { dg-bogus "this condition has identical branches" "" { xfail *-*-* } } */
kono
parents:
diff changeset
20 return a[A];
kono
parents:
diff changeset
21 else
kono
parents:
diff changeset
22 return a[5];
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 if (i == 3) /* { dg-bogus "this condition has identical branches" "" { xfail *-*-* } } */
kono
parents:
diff changeset
25 return a[5];
kono
parents:
diff changeset
26 else
kono
parents:
diff changeset
27 return a[A];
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 if (i == 4) /* { dg-warning "this condition has identical branches" } */
kono
parents:
diff changeset
30 return a[A];
kono
parents:
diff changeset
31 else
kono
parents:
diff changeset
32 return a[A];
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 if (i == 5) /* { dg-warning "this condition has identical branches" } */
kono
parents:
diff changeset
35 return a[i];
kono
parents:
diff changeset
36 else
kono
parents:
diff changeset
37 return a[i];
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 if (i == 6) /* { dg-bogus "this condition has identical branches" "" { xfail *-*-* } } */
kono
parents:
diff changeset
40 return a[I];
kono
parents:
diff changeset
41 else
kono
parents:
diff changeset
42 return a[i];
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 if (i == 7) /* { dg-bogus "this condition has identical branches" "" { xfail *-*-* } } */
kono
parents:
diff changeset
45 return a[i];
kono
parents:
diff changeset
46 else
kono
parents:
diff changeset
47 return a[I];
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 if (i == 8) /* { dg-warning "this condition has identical branches" } */
kono
parents:
diff changeset
50 return a[I];
kono
parents:
diff changeset
51 else
kono
parents:
diff changeset
52 return a[I];
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 if (i == 10) /* { dg-bogus "this condition has identical branches" "" { xfail *-*-* } } */
kono
parents:
diff changeset
55 g += A;
kono
parents:
diff changeset
56 else
kono
parents:
diff changeset
57 g += B;
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 if (i == 11) /* { dg-bogus "this condition has identical branches" "" { xfail *-*-* } } */
kono
parents:
diff changeset
60 g += B;
kono
parents:
diff changeset
61 else
kono
parents:
diff changeset
62 g += A;
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 if (i == 12) /* { dg-bogus "this condition has identical branches" "" { xfail *-*-* } } */
kono
parents:
diff changeset
65 g += A;
kono
parents:
diff changeset
66 else
kono
parents:
diff changeset
67 g += 5;
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 if (i == 12) /* { dg-bogus "this condition has identical branches" "" { xfail *-*-* } } */
kono
parents:
diff changeset
70 g += 5;
kono
parents:
diff changeset
71 else
kono
parents:
diff changeset
72 g += A;
kono
parents:
diff changeset
73 }