diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-09-29 17:09:10 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2019-09-30 03:45:53 +0200 |
| commit | d466a02815b8109ea007736590bdd97f5d0aeb2f (patch) | |
| tree | 5dd27f9401831f45ab77c6c31591327ec52c45a5 /validation/expand | |
| parent | fded889cd4b3e0b5eef95440d3f96723e76a78e9 (diff) | |
| parent | 5d0c4d96bdf4ab5df4ef0e31ab433e605299aabd (diff) | |
| download | sparse-dev-d466a02815b8109ea007736590bdd97f5d0aeb2f.tar.gz | |
Merge branch 'fix-expand-asm' into tip
Currently, ASM operands aren't expanded or even evaluated.
This causes Sparse to emit warnings about 'unknown expression'
during the linearization of these operands if they contains,
for example, calls to __builtin_compatible_types_p().
Note: the correct handling of ASM operands needs to make
the distinction between 'memory' operands and 'normal'
operands. For this, it is needed to look at the constraints
and these are architecture specific. The patches in this
series only consider the constraints m, v, o & Q as
being for memory operands and, happily, these seems
to cover most usage for the most common architectures.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/expand')
| -rw-r--r-- | validation/expand/asm0.c | 23 | ||||
| -rw-r--r-- | validation/expand/compound-literal.c | 26 |
2 files changed, 49 insertions, 0 deletions
diff --git a/validation/expand/asm0.c b/validation/expand/asm0.c new file mode 100644 index 00000000..568a4d19 --- /dev/null +++ b/validation/expand/asm0.c @@ -0,0 +1,23 @@ +static void foo(void) +{ + asm("" :: "i" (42 & 3)); + asm("" :: "i" (__builtin_constant_p(0))); +} + +/* + * check-name: expand-asm0 + * check-command: test-linearize $file + * + * check-output-start +foo: +.L0: + <entry-point> + asm "" + in: "i" ($2) + asm "" + in: "i" ($1) + ret + + + * check-output-end + */ diff --git a/validation/expand/compound-literal.c b/validation/expand/compound-literal.c new file mode 100644 index 00000000..034164bc --- /dev/null +++ b/validation/expand/compound-literal.c @@ -0,0 +1,26 @@ +#define SAME_TYPE(A, B) \ + __builtin_types_compatible_p(A, B) + +struct s { + int i; +}; + +static void foo(struct s *p) +{ + *p = (struct s) { .i = SAME_TYPE(int, int), }; +} + +/* + * check-name: compound-literal + * check-command: test-linearize $file + * + * check-output-start +foo: +.L0: + <entry-point> + store.32 $1 -> 0[%arg1] + ret + + + * check-output-end + */ |
