diff options
Diffstat (limited to 'validation/bad-check-access0.c')
| -rw-r--r-- | validation/bad-check-access0.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/validation/bad-check-access0.c b/validation/bad-check-access0.c new file mode 100644 index 00000000..3c4c023f --- /dev/null +++ b/validation/bad-check-access0.c @@ -0,0 +1,31 @@ +#define SIZE 2 +static int buf[SIZE]; + +static inline int swt(int i) +{ + switch (i) { + case 0 ... (SIZE-1): + return buf[i]; + default: + return 0; + } +} + +static int switch_ok(void) { return swt(1); } +static int switch_ko(void) { return swt(2); } + + +static inline int cbr(int i, int p) +{ + if (p) + return buf[i]; + else + return 0; +} + +static int branch_ok(int x) { return cbr(1, x != x); } +static int branch_ko(int x) { return cbr(2, x != x); } + +/* + * check-name: bad-check-access0 + */ |
