aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/tsan/pr81275.c
blob: 024b0c72f2c21fd34d90aabbd3f9027ffe21397e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/* PR sanitizer/81275 */
/* { dg-do compile } */
/* { dg-options "-Wreturn-type -fsanitize=thread" } */

int
f1 (int a, int b)
{
  switch (a)
    {
    case 0:
      switch (b)
        {
        case 5:
	  return 6;
	case 7:
	  return 8;
	default:
	  return 0;
	}
      break;
    default:
      return 0;
    }
}	/* { dg-bogus "control reaches end of non-void function" } */

int
f2 (int a, int b)
{
  switch (a)
    {
    case 0:
      switch (b)
        {
        case 5:
	  return 6;
	case 7:
	  return 8;
	default:
	  return 0;
	}
    default:
      return 0;
    }
}	/* { dg-bogus "control reaches end of non-void function" } */

int
f3 (int a, int b)
{
  switch (a)
    {
    case 0:
      switch (b)
        {
        case 5:
	  return 6;
	case 7:
	  return 8;
	case 8:
	  break;
	default:
	  return 0;
	}
      break;
    default:
      return 0;
    }
}	/* { dg-warning "control reaches end of non-void function" } */

int
f4 (int a, int b)
{
  switch (a)
    {
    case 0:
      switch (b)
        {
        case 5:
	  return 6;
	case 7:
	  return 8;
	}
      break;
    default:
      return 0;
    }
}	/* { dg-warning "control reaches end of non-void function" } */

int
f5 (int a, unsigned char b)
{
  switch (a)
    {
    case 0:
      switch (b)
        {
	case 0:
	  return 1;
	case 3 ... 10:
	  return 2;
	case 1 ... 2:
	  return 3;
	case 126 ... (unsigned char) ~0:
	  return 4;
	case 11 ... 125:
	  return 5;
	}
      break;
    default:
      return 0;
    }
}	/* { dg-bogus "control reaches end of non-void function" } */