File: unreachable.c

package info (click to toggle)
lclint 1%3A2.4b-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 7,996 kB
  • ctags: 9,589
  • sloc: ansic: 100,034; lex: 2,754; yacc: 2,472; makefile: 835
file content (48 lines) | stat: -rw-r--r-- 655 bytes parent folder | download | duplicates (9)
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
/*@exits@*/ void f (void)
{
  int x = 3;

  exit(x);
  x++; /* 1. Unreachable code */
}

void tu(int y)
{
  int x = 16;

  if (x == y)
    {
      return;
    }
  else
    {
      x++;
      f();
      return; /* 2. Unreachable code */
    }

  y++; /* 3. Unreachable code: no longer reported because of previous error. */
}

int s(int z)
{
  switch (z)
    {
    case 1: return 3;
    case 2: return 12;
    case 3: z++; return z; z--; /* 4. Unreachable code */
    case 4: /* 5. Fall through case */
      switch (z + 1)
	{
	case 1: return 18;
	case 2: z++;
	}
      return z;
    default:
      return 12;
    }
  
  z++; /* 6. Unreachable code */
}