diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-12-08 18:36:43 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-12-10 23:26:23 +0100 |
commit | ae0ec237a888ee6a2c755d4cdf8b1015e63e55a7 (patch) | |
tree | 86358e1a57227c9c1be3c3ad3389647d953cc8eb | |
parent | aa2235905e9afd2f14fbc26b0159e5b64e07314e (diff) | |
download | sparse-ae0ec237a888ee6a2c755d4cdf8b1015e63e55a7.tar.gz |
add testcase for addressability of degenerated symbol
An array or a function that degenerates into a pointer
has its address implicitly taken since the result is
equivalent to '&array[0]' or '&fun'.
So, the corresponding symbol needs to be marked as
addressable, like when its address is explicitly taken.
Add a testcase to illustrate this.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | validation/eval/addressable-degen.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/validation/eval/addressable-degen.c b/validation/eval/addressable-degen.c new file mode 100644 index 00000000..e1dc5107 --- /dev/null +++ b/validation/eval/addressable-degen.c @@ -0,0 +1,18 @@ +extern void def(void *, unsigned int); + +static int bar(void) +{ + int x[2] = { 1, 2 }; + + def(x, sizeof(x)); + return x[1]; +} + +/* + * check-name: eval/addressable-degen + * check-command: test-linearize -fdump-ir $file + * check-known-to-fail + * + * check-output-ignore + * check-output-contains: load\\. + */ |