diff options
Diffstat (limited to 'validation/linear')
| -rw-r--r-- | validation/linear/compound-literal00.c | 18 | ||||
| -rw-r--r-- | validation/linear/compound-literal01.c | 18 | ||||
| -rw-r--r-- | validation/linear/compound-literal02.c | 19 |
3 files changed, 55 insertions, 0 deletions
diff --git a/validation/linear/compound-literal00.c b/validation/linear/compound-literal00.c new file mode 100644 index 00000000..f3069d2c --- /dev/null +++ b/validation/linear/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/linear/compound-literal01.c b/validation/linear/compound-literal01.c new file mode 100644 index 00000000..e45fade3 --- /dev/null +++ b/validation/linear/compound-literal01.c @@ -0,0 +1,18 @@ +struct bfs { + int a: 2; + int b: 30; +}; + +int foo(void) +{ + struct bfs bf = { .a = 1, .b = 2 }; + return (struct bfs[]){bf}[0].b; +} + +/* + * check-name: compound-literal01.c + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + * check-output-contains: ret\\..*\\$2 + */ diff --git a/validation/linear/compound-literal02.c b/validation/linear/compound-literal02.c new file mode 100644 index 00000000..87b98d76 --- /dev/null +++ b/validation/linear/compound-literal02.c @@ -0,0 +1,19 @@ +struct bfs { + int a: 2; + int b: 30; +}; + +int bar(void) +{ + struct bfs bf = { .a = 1, .b = 4 }; + return (struct bfs[]){bf, { .a = 3, .b = 6}}[1].b; +} + +/* + * check-name: compound-literal02.c + * check-command: test-linearize -Wno-decl $file + * + * check-known-to-fail + * check-output-ignore + * check-output-contains: ret\\..*\\$6 + */ |
