comparison gcc/testsuite/c-c++-common/tsan/pr81275.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 /* PR sanitizer/81275 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wreturn-type -fsanitize=thread" } */
4
5 int
6 f1 (int a, int b)
7 {
8 switch (a)
9 {
10 case 0:
11 switch (b)
12 {
13 case 5:
14 return 6;
15 case 7:
16 return 8;
17 default:
18 return 0;
19 }
20 break;
21 default:
22 return 0;
23 }
24 } /* { dg-bogus "control reaches end of non-void function" } */
25
26 int
27 f2 (int a, int b)
28 {
29 switch (a)
30 {
31 case 0:
32 switch (b)
33 {
34 case 5:
35 return 6;
36 case 7:
37 return 8;
38 default:
39 return 0;
40 }
41 default:
42 return 0;
43 }
44 } /* { dg-bogus "control reaches end of non-void function" } */
45
46 int
47 f3 (int a, int b)
48 {
49 switch (a)
50 {
51 case 0:
52 switch (b)
53 {
54 case 5:
55 return 6;
56 case 7:
57 return 8;
58 case 8:
59 break;
60 default:
61 return 0;
62 }
63 break;
64 default:
65 return 0;
66 }
67 } /* { dg-warning "control reaches end of non-void function" } */
68
69 int
70 f4 (int a, int b)
71 {
72 switch (a)
73 {
74 case 0:
75 switch (b)
76 {
77 case 5:
78 return 6;
79 case 7:
80 return 8;
81 }
82 break;
83 default:
84 return 0;
85 }
86 } /* { dg-warning "control reaches end of non-void function" } */
87
88 int
89 f5 (int a, unsigned char b)
90 {
91 switch (a)
92 {
93 case 0:
94 switch (b)
95 {
96 case 0:
97 return 1;
98 case 3 ... 10:
99 return 2;
100 case 1 ... 2:
101 return 3;
102 case 126 ... (unsigned char) ~0:
103 return 4;
104 case 11 ... 125:
105 return 5;
106 }
107 break;
108 default:
109 return 0;
110 }
111 } /* { dg-bogus "control reaches end of non-void function" } */