diff options
| -rw-r--r-- | evaluate.c | 2 | ||||
| -rw-r--r-- | validation/badtype5.c | 18 | ||||
| -rw-r--r-- | validation/linear/missing-insn-size.c | 19 |
3 files changed, 39 insertions, 0 deletions
@@ -1738,6 +1738,8 @@ static struct symbol *evaluate_dereference(struct expression *expr) return expr->ctype; } + examine_symbol_type(ctype); + /* Dereferencing a node drops all the node information. */ if (ctype->type == SYM_NODE) ctype = ctype->ctype.base_type; diff --git a/validation/badtype5.c b/validation/badtype5.c new file mode 100644 index 00000000..c3c34ab2 --- /dev/null +++ b/validation/badtype5.c @@ -0,0 +1,18 @@ +#define __force __attribute__((force)) + +int foo(int *addr); +int foo(int *addr) +{ + return *(*((typeof(addr) __force *) addr)); +} + +/* + * check-name: badtype5.c + * check-description: + * evaluate_dereference() used to miss a call to + * examine_symbol_type(). This, in the present, left + * a SYM_TYPEOF as type for the last dereferencing + * which produced "error: cannot dereference this type". + * The presence of the __force and the typeof is needed + * to create the situation. + */ diff --git a/validation/linear/missing-insn-size.c b/validation/linear/missing-insn-size.c new file mode 100644 index 00000000..fe588634 --- /dev/null +++ b/validation/linear/missing-insn-size.c @@ -0,0 +1,19 @@ +int foo(int **a); +int foo(int **a) +{ + return **a; +} + +/* + * check-name: missing instruction's size + * check-description: + * sparse used to have a problem with *all* + * double dereferencing due to missing a + * call to examine_symbol_type(). The symptom + * here is that the inner deref had no type. + * check-command: test-linearize $file + * check-output-ignore + * + * check-output-excludes: load\\s + * check-output-contains: load\\. + */ |
