diff options
Diffstat (limited to 'validation')
| -rw-r--r-- | validation/cond-address-array.c | 26 | ||||
| -rw-r--r-- | validation/cond-address-function.c | 18 | ||||
| -rw-r--r-- | validation/cond-address.c | 14 | ||||
| -rw-r--r-- | validation/kill-phi-ttsbb2.c | 40 |
4 files changed, 98 insertions, 0 deletions
diff --git a/validation/cond-address-array.c b/validation/cond-address-array.c new file mode 100644 index 00000000..e1d2f87f --- /dev/null +++ b/validation/cond-address-array.c @@ -0,0 +1,26 @@ +int foo(void) { + extern int a[]; + + if (a) + return 1; + return 0; +} + +int bar(void) { + int a[2]; + + if (a) + return 1; + return 0; +} + +/* + * check-name: cond-address-array.c + * check-command: test-linearize -Wno-decl -Waddress $file + * check-output-ignore + * + * check-error-start +cond-address-array.c:4:13: warning: the address of an array will always evaluate as true +cond-address-array.c:12:13: warning: the address of an array will always evaluate as true + * check-error-end + */ diff --git a/validation/cond-address-function.c b/validation/cond-address-function.c new file mode 100644 index 00000000..9a143a00 --- /dev/null +++ b/validation/cond-address-function.c @@ -0,0 +1,18 @@ +extern void func(void); + +int global_function(void) +{ + if (func) + return 1; + return 0; +} + +/* + * check-name: cond-address-function + * check-command: test-linearize -Wno-decl -Waddress $file + * check-output-ignore + * + * check-error-start +cond-address-function.c:5:13: warning: the address of a function will always evaluate as true + * check-error-end + */ diff --git a/validation/cond-address.c b/validation/cond-address.c new file mode 100644 index 00000000..2a69f4b9 --- /dev/null +++ b/validation/cond-address.c @@ -0,0 +1,14 @@ +extern void f(void); +extern int a[]; + +int foo(void) { if (f) return 1; return 0; } +int bar(void) { if (a) return 1; return 0; } +int qux(void) { if (f && a) return 1; return 0; } + +/* + * check-name: cond-address.c + * check-command: test-linearize -Wno-decl $file + * check-output-ignore + * + * check-excludes: VOID + */ diff --git a/validation/kill-phi-ttsbb2.c b/validation/kill-phi-ttsbb2.c new file mode 100644 index 00000000..c7d89aa0 --- /dev/null +++ b/validation/kill-phi-ttsbb2.c @@ -0,0 +1,40 @@ +extern int error(int); + +int foo(int perr); +int foo(int perr) +{ + int err = 0; + int rc = 0; + int j = 0; + int i = 1; + + i && j++; + + i-- && j; + + i && j--; + + if (j != 1) { + err = 1; + if (perr) + error(1); + } + + if (err != 0) + rc = 1; + + return rc; +} + +/* + * check-name: kill-phi-ttsbb2 + * check-description: + * Verify if OP_PHI usage is adjusted after successful try_to_simplify_bb() + * check-warning: this test is sensitive to details of code generation + * with proper bb packing (taking care of phi-nodes) it + * will be optimized away and test nothing. You have been warned. + * check-command: test-linearize $file + * check-output-ignore + * + * check-output-excludes: VOID + */ |
