aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-04-11 11:19:31 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-05-21 17:27:45 +0200
commit557aba56c4bc4c4b4c38b97a2d545c31e0706b31 (patch)
tree433d6aaa322595d9434b57fabfb5462edc67c568
parent633a390c169082646e7172c753f319568ef22695 (diff)
downloadsparse-557aba56c4bc4c4b4c38b97a2d545c31e0706b31.tar.gz
bad-goto: do not linearize if the IR will be invalid
In some error cases, it's not possible to produce a valid & correct IR for the concerned function. For exemple, if the AST contains invalid gotos, the CFG will either be invalid or won't correspond to the erroneous source code. So, refuse to linearize such functions. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--linearize.c2
-rw-r--r--symbol.h1
2 files changed, 2 insertions, 1 deletions
diff --git a/linearize.c b/linearize.c
index b040d345..49274681 100644
--- a/linearize.c
+++ b/linearize.c
@@ -2480,7 +2480,7 @@ static struct entrypoint *linearize_fn(struct symbol *sym, struct symbol *base_t
pseudo_t result;
int i;
- if (!stmt)
+ if (!stmt || sym->bogus_linear)
return NULL;
ep = alloc_entrypoint();
diff --git a/symbol.h b/symbol.h
index 7241f13d..50dba78a 100644
--- a/symbol.h
+++ b/symbol.h
@@ -171,6 +171,7 @@ struct symbol {
unsigned long offset;
int bit_size;
unsigned int bit_offset:8,
+ bogus_linear:1,
variadic:1,
initialized:1,
examined:1,