diff options
| author | Pekka Enberg <penberg@kernel.org> | 2012-08-19 12:25:11 +0300 |
|---|---|---|
| committer | Pekka Enberg <penberg@kernel.org> | 2012-08-19 12:25:11 +0300 |
| commit | 33844e787a0ed80d04b2917042fec50ccf4c91dd (patch) | |
| tree | 7ba44d11c0558027cdc3d519ade41048ac7a0755 /validation/backend | |
| parent | e49d1f0f310b8b6d9ef610e1e7108879bf24cdca (diff) | |
| download | sparse-dev-33844e787a0ed80d04b2917042fec50ccf4c91dd.tar.gz | |
sparse, llvm: Fix 'void' return type code generation
Jonathan Neuschäfer reports:
A simple function like this will compile to the following llvm
bitcode:
/* C */
void func(void) {
return;
}
/* LLVM */
define i8 @func() {
L0:
ret void
}
The return type of the function and the type in the return instruction
don't match.
I found this inconsistency by running LLVM's bitcode validation on the
bitcode produced by sparse-llvm.
Move 'void *' special-casing from sym_basetype_type() to sym_ptr_type()
to fix the issue.
Reported by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Cc: Christopher Li <sparse@chrisli.org>
Cc: Jeff Garzik <jgarzik@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'validation/backend')
| -rw-r--r-- | validation/backend/void-return-type.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/validation/backend/void-return-type.c b/validation/backend/void-return-type.c new file mode 100644 index 00000000..b282fdee --- /dev/null +++ b/validation/backend/void-return-type.c @@ -0,0 +1,13 @@ +static void foo(void) +{ +} + +static void *bar(void *p) +{ + return p; +} + +/* + * check-name: void return type code generation + * check-command: ./sparsec -c $file -o tmp.o + */ |
