diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-12-06 01:51:04 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-12-10 23:26:23 +0100 |
commit | 613a671f31d2a44aa2e04ce05b77d1daad972f20 (patch) | |
tree | 2f396c076dcf60631c8ab088276a16102928db41 | |
parent | ae0ec237a888ee6a2c755d4cdf8b1015e63e55a7 (diff) | |
download | sparse-613a671f31d2a44aa2e04ce05b77d1daad972f20.tar.gz |
add testcase for addressability of 'complex' symbols
Once a symbol has its address taken, a lot of simplifications
must be avoided because the symbol can now be modified via
a pointer.
This is currently done but the symbol addressability
does not take in account the fact that a symbol can be
accessed via one of its subfields.
Add a testcase to illustrate this.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | validation/eval/addressable-complex.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/validation/eval/addressable-complex.c b/validation/eval/addressable-complex.c new file mode 100644 index 00000000..62ab59f0 --- /dev/null +++ b/validation/eval/addressable-complex.c @@ -0,0 +1,24 @@ +extern void def(void *); + +struct s1 { + int a; +}; + +int use1(void) +{ + struct s1 s = { 3 }; + + def(&s.a); + + return s.a; +} + +/* + * check-name: eval/addressable-complex + * check-command: test-linearize -Wno-decl -fdump-ir $file + * check-known-to-fail + * + * check-output-ignore + * check-output-contains: load\\. + * check-output-excludes: return\\..*\\$3 + */ |