expressions: make assign_expression() take an op argument
[smatch.git] / validation / crazy02-not-so.c
blob19ee25299f745cc84d7e0f667bf850343a2a813a
1 int foo(int *ptr, int i)
3 int *p;
5 switch (i - i) { // will be optimized to 0
6 case 0:
7 return 0;
8 case 1: // will be optimized away
9 p = ptr;
10 do { // will be an unreachable loop
11 *p++ = 123;
12 } while (--i);
13 break;
16 return 1;
19 int bar(int *ptr, int i)
21 int *p;
23 switch (i - i) { // will be optimized to 0
24 case 0:
25 return 0;
26 case 1: // will be optimized away
27 // p is uninitialized
28 do { // will be an unreachable loop
29 *p++ = 123;
30 } while (--i);
31 break;
34 return 1;
38 * check-name: crazy02-not-so.c
39 * check-command: sparse -Wno-decl $file