diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-07-31 14:31:04 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-07-31 22:12:42 +0200 |
| commit | 0900bf5f8b92593877bd41dc1e15705c2bb602f5 (patch) | |
| tree | 078430d78dc2df97cab2a1d3f9c4279dddc5499b /validation | |
| parent | d254b816c4b6b8a692507567ad9127ca9991596d (diff) | |
| download | sparse-dev-0900bf5f8b92593877bd41dc1e15705c2bb602f5.tar.gz | |
fix infinite simplification loops
Each time a parent is removed from a BB there is
the possibility that the BB become unreachable.
This in turn can create cycles of dead BBs which
can the create inifinite loops during the
simplification process.
Fix this by setting the flag REPEAT_CFG_CLEANUP when
a branch is rewritten, this will in turn trigger
a call to kill_unreachable_bbs() which will break
these loops.
Reported-by: Michael Stefaniuc <mstefani@mykolab.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
| -rw-r--r-- | validation/infinite-loop02.c | 11 | ||||
| -rw-r--r-- | validation/infinite-loop03.c | 16 |
2 files changed, 27 insertions, 0 deletions
diff --git a/validation/infinite-loop02.c b/validation/infinite-loop02.c new file mode 100644 index 00000000..7d0761d8 --- /dev/null +++ b/validation/infinite-loop02.c @@ -0,0 +1,11 @@ +void foo(void) +{ + int a = 1; + while ((a = !a)) + ; +} + +/* + * check-name: infinite loop 02 + * check-command: sparse -Wno-decl $file + */ diff --git a/validation/infinite-loop03.c b/validation/infinite-loop03.c new file mode 100644 index 00000000..ac8a9519 --- /dev/null +++ b/validation/infinite-loop03.c @@ -0,0 +1,16 @@ +static void foo(int *buf) +{ + int a = 1; + int *b; + do { + if (a) + b = buf; + if (a) + *buf = 0; + } while (!(a = !a)); +} + +/* + * check-name: infinite loop 03 + * check-command: sparse -Wno-decl $file + */ |
