aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/linear/call-indirect.c
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-11-29 10:51:08 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-12-21 01:53:52 +0100
commit2be50b1451d954b4ea4579bcb7173e57d8a07161 (patch)
treedb616322c39b4b1326575e181ee4b4ce289060d7 /validation/linear/call-indirect.c
parentc2f4b9f69159eb8604f6371687a796d40920f093 (diff)
downloadsparse-dev-2be50b1451d954b4ea4579bcb7173e57d8a07161.tar.gz
fix linearize (*fun)()
A function call via a function pointer can be written like: fp(), (fp)() or (*fp)() In the latter case the dereference is unneeded but legal and idiomatic. However, the linearization doesn't handle this unneeded deref and leads to the generation of a load of the pointer: int foo(int a, int (*fun)(int)) { (*fun)(a); } gives something like: foo: load %r2 <- 0[%arg2] call.32 %r3 <- %r2, %arg1 ret.32 %r3 This happens because, at linearization, the deref is dropped but only if the sub-expression is a symbol and the test for node is not done. Fix this by using is_func_type() to test the type of all call expressions. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/linear/call-indirect.c')
-rw-r--r--validation/linear/call-indirect.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/validation/linear/call-indirect.c b/validation/linear/call-indirect.c
index 8ab78676..f5f2adaf 100644
--- a/validation/linear/call-indirect.c
+++ b/validation/linear/call-indirect.c
@@ -6,7 +6,6 @@ int g1(int (*fun)(void)) { return (*fun)(); } // C99,C11 6.5.3.2p4
/*
* check-name: indirect calls
* check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
*
* check-output-ignore
* check-output-excludes: load