Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- validation/compound-literal00.c | 18 ++++++++++++++++++ validation/compound-literal01.c | 27 +++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 validation/compound-literal00.c create mode 100644 validation/compound-literal01.c diff --git a/validation/compound-literal00.c b/validation/compound-literal00.c new file mode 100644 index 000000000..f3069d2ca --- /dev/null +++ b/validation/compound-literal00.c @@ -0,0 +1,18 @@ +struct bfs { + int a: 2; + int b: 30; +}; + +int foo(void) +{ + return (struct bfs){ .a = 1, .b = 2}.b; +} + +/* + * check-name: compound-literal00.c + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + * check-output-contains: ret\\..*\\$2 + * check-error-end + */ diff --git a/validation/compound-literal01.c b/validation/compound-literal01.c new file mode 100644 index 000000000..8a4935ea7 --- /dev/null +++ b/validation/compound-literal01.c @@ -0,0 +1,27 @@ +struct bfs { + int a: 2; + int b: 30; +}; + +int foo(void) +{ + struct bfs bf = { .a = 1, .b = 2 }; + return (struct bfs[]){bf}[0].b; +} + +int bar(void) +{ + struct bfs bf = { .a = 1, .b = 4 }; + return (struct bfs[]){bf, { .a = 3, .b = 6}}[1].b; +} + +/* + * check-name: compound-literal01.c + * check-command: test-linearize -Wno-decl $file + * + * check-known-to-fail + * check-output-ignore + * check-output-contains: ret\\..*\\$2 + * check-output-contains: ret\\..*\\$6 + * check-error-end + */ -- 2.14.0 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html