From ae0ec237a888ee6a2c755d4cdf8b1015e63e55a7 Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Sun, 8 Dec 2019 18:36:43 +0100 Subject: 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 --- validation/eval/addressable-degen.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 validation/eval/addressable-degen.c 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\\. + */ -- cgit 1.2.3-korg