diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-08-20 23:45:38 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-12-21 12:40:29 +0100 |
| commit | c18aec74fd9fd77f2234dd11dd6444339c66d99e (patch) | |
| tree | 670d98a6e3e3cc155145fe6a9643074f92694304 /validation | |
| parent | 178f19ad47c916ce02b286ec9cf831950340a4ac (diff) | |
| download | sparse-dev-c18aec74fd9fd77f2234dd11dd6444339c66d99e.tar.gz | |
add testcase for constant bitfield dereference
Reported-by: Dibyendu Majumdar <mobile@majumdar.org.uk>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
| -rw-r--r-- | validation/linear/bitfield-expand-deref.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/validation/linear/bitfield-expand-deref.c b/validation/linear/bitfield-expand-deref.c new file mode 100644 index 00000000..0a958633 --- /dev/null +++ b/validation/linear/bitfield-expand-deref.c @@ -0,0 +1,28 @@ +struct s { + int a:8; + int b:8; +}; + +int foo(void) +{ + struct s x = { .a = 12, .b = 34, }; + + return x.b; +} + +int bar(int a) +{ + struct s x = { .a = 12, .b = a, }; + + return x.b; +} + +/* + * check-name: bitfield expand deref + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-excludes: ret\..*\$12 + * check-output-contains: ret\..*\$34 + */ |
