diff options
author | Christopher Li <sparse@chrisli.org> | 2011-08-11 03:44:34 -0700 |
---|---|---|
committer | Christopher Li <sparse@chrisli.org> | 2011-08-14 14:09:47 -0700 |
commit | 5b57cb8105f9fe00119a12462f09f3106b1e6117 (patch) | |
tree | e5c1089ce42ae183905c487426da193a6e8e6e41 | |
parent | 064f61f7325f898474779b82759ae48aea118c69 (diff) | |
download | sparse-5b57cb8105f9fe00119a12462f09f3106b1e6117.tar.gz |
validation: inline switch statement
This bug is reported by Randy. Al provides the simplify
version of the test case.
It generate error message on the current sparse:
warning: unreplaced symbol 'val'
This is some bug in the switch inline code.
Signed-off-by: Christopher Li <sparse@chrisli.org>
-rw-r--r-- | validation/bug_inline_switch.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/validation/bug_inline_switch.c b/validation/bug_inline_switch.c new file mode 100644 index 00000000..95788240 --- /dev/null +++ b/validation/bug_inline_switch.c @@ -0,0 +1,25 @@ + +#define __u16 unsigned short +int foo(__u16 n); +static inline __u16 f(__u16 val) +{ + return val; +} + +static inline unsigned int bar(__u16 n) +{ + switch (n) { + case (1 ? 1 : f(1)): + return 4; + } +} + +int foo(__u16 n) +{ + bar(n); + bar(n); + return 0; +} +/* + * check-name: inlining switch statement + */ |